@1ec5 commented on this pull request.


> +    <select role="button" class="p-0 position-absolute top-0 start-0 w-100 
> h-100 language-change-trigger text-transparent bg-transparent <%= classes %>">
+      <% Locale.available
+               .select { |locale| I18n.exists? 
"shared.language_selector.#{locale}" }
+               .sort_by { |locale| t(".#{locale}") }
+               .each do |locale| %>
+        <option class="form-select" value="<%= locale.to_s %>" <%= "selected" 
if I18n.locale.to_s == locale.to_s %>><%= t(".#{locale}") %></option>
+      <% end %>
+    </select>

[`Intl.DisplayNames.prototype.of()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/of)
 returns undefined if the language code is unrecognized, so we could fall back 
to the raw code. It only throws an exception on a malformed language code. But 
if we already have a string that we can access at build time, that would be 
good too. In that case, we wouldn’t need all those added lines in the YAML 
file, one for each language…

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5201#discussion_r2087048210
You are receiving this because you are subscribed to this thread.

Message ID: 
<openstreetmap/openstreetmap-website/pull/5201/review/2837146...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to