Note that in order to simplify the component tests (which for some reason seem to be whitespace-sensitive), we have to omit whitespace characters inside the `<option>` tags. Also note we're simplifying the test with a missing language name; since a component test doesn't involve a whole request, we don't need a complex setup (I'm not sure we even need it in system tests).
16 lines
612 B
Plaintext
16 lines
612 B
Plaintext
<% if I18n.available_locales.size > 1 %>
|
|
<div class="locale">
|
|
<form class="locale-form">
|
|
<label class="inline-block" for="locale-switcher">
|
|
<%= t("layouts.header.locale") %>
|
|
</label>
|
|
<select class="js-location-changer locale-switcher inline-block" name="locale-switcher" id="locale-switcher">
|
|
<% I18n.available_locales.map do |loc| %>
|
|
<option <%= "selected" if loc == I18n.locale %>
|
|
value="<%= current_path_with_query_params(locale: loc) %>"><%= name_for_locale(loc) %></option>
|
|
<% end %>
|
|
</select>
|
|
</form>
|
|
</div>
|
|
<% end %>
|