[openstreetmap/openstreetmap-website] Add locale selector (PR #5201)
David Tsiklauri
notifications at github.com
Wed Oct 23 11:05:39 UTC 2024
@nertc commented on this pull request.
> + <% Locale.available
+ .map { |locale| Language.find_by(:code => locale.to_s) }
+ .select { |locale| locale }
+ .sort_by { |locale| locale[:english_name] }
+ .each do |language| %>
+ <option class="form-select" value="<%= language.code %>" <%= "selected" if I18n.locale.to_s == language.code %>><%= language.name %></option>
Pushed code can be shortened as `Language.where(:code => Locale.available.map {|locale| locale.to_s})`. This approach will also cause only one DB query. If there is no other reason for language not to be used, I'll push the code with this approach. Translating language names using i18n and not having one source for them, may cause duplicate translations or inconsistency (because of multiple functionalities using language names).
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5201#discussion_r1812499419
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5201/review/2388232698 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20241023/65fdc8e0/attachment.htm>
More information about the rails-dev
mailing list