@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/2388232...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev