Add a lang attribute to language options

I'm not sure screen readers recognize this attribute inside `<option>`
tags, but if they do, it'll probably be helpful. And if they don't, no
harm will be done.
This commit is contained in:
Javi Martín
2021-06-28 18:52:03 +02:00
parent 229fe8086a
commit b8870dd95a

View File

@@ -5,7 +5,7 @@
</label> </label>
<select class="js-location-changer locale-switcher inline-block" name="locale-switcher" id="locale-switcher"> <select class="js-location-changer locale-switcher inline-block" name="locale-switcher" id="locale-switcher">
<% locales.map do |loc| %> <% locales.map do |loc| %>
<option <%= "selected" if loc == I18n.locale %> <option lang="<%= loc %>" <%= "selected" if loc == I18n.locale %>
value="<%= current_path_with_query_params(locale: loc) %>"><%= name_for_locale(loc) %></option> value="<%= current_path_with_query_params(locale: loc) %>"><%= name_for_locale(loc) %></option>
<% end %> <% end %>
</select> </select>