[openstreetmap/openstreetmap-website] Language selection enhancements (PR #6412)

Tom Hughes notifications at github.com
Wed Sep 24 17:34:47 UTC 2025


@tomhughes commented on this pull request.



> -          <% end %>
-        <% else %>
-          <%= render "layouts/select_language_list" %>
-        <% end %>
+        <div class="mb-3 px-2">
+          <%= text_field_tag :language_search,
+                             params[:language_search],
+                             :placeholder => t("languages_panes.select_language_list.search_language", :default => "Search..."),
+                             :autocomplete => "off",
+                             :dir => "auto",
+                             :class => "form-control py-2 px-3" %>
+        </div>
+        <turbo-frame id="select_language_list" src="<%= languages_pane_path %>?source=<%= ERB::Util.url_encode(request.fullpath) %>" loading="lazy">
+          <div class="text-center py-3">
+            <div class="spinner-border text-secondary" role="status">
+              <span class="visually-hidden">Loading...</span>

Presumably `Loading...` here should be translatable...

> @@ -112,19 +112,25 @@
   <div class="modal-dialog modal-lg modal-dialog-scrollable">
     <div class="modal-content">
       <div class="modal-header">
-        <h1 class="modal-title fs-5" id="select_language_dialog_label"><%= t ".select_language" %></h1>
+        <h1 class="modal-title fs-5" id="select_language_dialog_label"><%= t "languages_panes.select_language_list.header.select_language" %></h1>

What was the logic of moving this string so that it then needed a fully qualified name? I don't it's used in the partial whose scope you've now put it is it?

>          <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="<%= t "javascripts.close" %>"></button>
       </div>
       <div class="modal-body px-1">
-        <% if current_user&.id %>
-          <%= form_tag basic_preferences_path, :method => "PUT" do %>
-            <%= hidden_field_tag "referer", request.fullpath %>
-            <%= hidden_field_tag "language", I18n.locale %>
-            <%= render "layouts/select_language_list" %>
-          <% end %>
-        <% else %>
-          <%= render "layouts/select_language_list" %>
-        <% end %>
+        <div class="mb-3 px-2">
+          <%= text_field_tag :language_search,
+                             params[:language_search],
+                             :placeholder => t("languages_panes.select_language_list.search_language", :default => "Search..."),

Same question here about the scope of the resource string, though obviously in this case it depends on if the form stays here or moves but in general we put translations in the scope where they're used so we can refer to them with a relative name.

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

Message ID: <openstreetmap/openstreetmap-website/pull/6412/review/3263946073 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250924/9e8053a5/attachment-0001.htm>


More information about the rails-dev mailing list