]> git.openstreetmap.org Git - rails.git/commitdiff
Pass translation scope instead of keys to shared pagination
authorAnton Khorev <tony29@yandex.ru>
Tue, 10 Sep 2024 07:37:36 +0000 (10:37 +0300)
committerAnton Khorev <tony29@yandex.ru>
Tue, 10 Sep 2024 07:37:36 +0000 (10:37 +0300)
app/views/diary_comments/_page.html.erb
app/views/diary_entries/_page.html.erb
app/views/issues/_page.html.erb
app/views/shared/_pagination.html.erb
app/views/traces/_page.html.erb
app/views/user_blocks/_blocks.html.erb
app/views/users/_page.html.erb
config/locales/en.yml
test/system/issues_test.rb

index 66e40cd805733223825fc3bd731cd4ac297bb481..20663a176e7f1512a86dc897fe0e8fa34d95727b 100644 (file)
@@ -19,8 +19,7 @@
   </table>
 
   <%= render "shared/pagination",
   </table>
 
   <%= render "shared/pagination",
-             :newer_key => "diary_comments.page.newer_comments",
-             :older_key => "diary_comments.page.older_comments",
+             :translation_scope => "shared.pagination.diary_comments",
              :newer_id => @newer_comments_id,
              :older_id => @older_comments_id %>
 </turbo-frame>
              :newer_id => @newer_comments_id,
              :older_id => @older_comments_id %>
 </turbo-frame>
index f07db9b6c73c953f0172f28b202e3b4a2b6f8f6f..f0a99928fd326a13550526f42ccfbb398decfbce 100644 (file)
@@ -4,8 +4,7 @@
   <%= render @entries %>
 
   <%= render "shared/pagination",
   <%= render @entries %>
 
   <%= render "shared/pagination",
-             :newer_key => "diary_entries.page.newer_entries",
-             :older_key => "diary_entries.page.older_entries",
+             :translation_scope => "shared.pagination.diary_entries",
              :newer_id => @newer_entries_id,
              :older_id => @older_entries_id %>
 </turbo-frame>
              :newer_id => @newer_entries_id,
              :older_id => @older_entries_id %>
 </turbo-frame>
index b46b1798c96e2d3723b09065b947ace78208d20f..8cada7564e7872fb14b40b9a35a1b37d12d467e4 100644 (file)
@@ -36,8 +36,7 @@
       </tbody>
     </table>
     <%= render "shared/pagination",
       </tbody>
     </table>
     <%= render "shared/pagination",
-               :newer_key => "issues.page.newer_issues",
-               :older_key => "issues.page.older_issues",
+               :translation_scope => "shared.pagination.issues",
                :newer_id => @newer_issues_id,
                :older_id => @older_issues_id %>
   <% end %>
                :newer_id => @newer_issues_id,
                :older_id => @older_issues_id %>
   <% end %>
index c8eddcd379b9ca414d44f24b45ffdee99b0f901a..be701bc23bd571e54e1cca2a7938af99f70a9078 100644 (file)
@@ -3,7 +3,7 @@
   <ul class="pagination">
     <% newer_link_content = capture do %>
       <%= previous_page_svg_tag :class => "flex-shrink-0 d-none d-sm-block" %>
   <ul class="pagination">
     <% newer_link_content = capture do %>
       <%= previous_page_svg_tag :class => "flex-shrink-0 d-none d-sm-block" %>
-      <%= t(newer_key) %>
+      <%= t :newer, :scope => translation_scope %>
     <% end %>
     <% if newer_id -%>
       <li class="page-item d-flex">
     <% end %>
     <% if newer_id -%>
       <li class="page-item d-flex">
@@ -16,7 +16,7 @@
     <% end -%>
 
     <% older_link_content = capture do %>
     <% end -%>
 
     <% older_link_content = capture do %>
-      <%= t(older_key) %>
+      <%= t :older, :scope => translation_scope %>
       <%= next_page_svg_tag :class => "flex-shrink-0 d-none d-sm-block" %>
     <% end %>
     <% if older_id -%>
       <%= next_page_svg_tag :class => "flex-shrink-0 d-none d-sm-block" %>
     <% end %>
     <% if older_id -%>
index e1ce3fe48604a897b201f1beeb40837ad9a8b982..cb9716fc9fb2c932b4f4e90dbe0b089cf58568f4 100644 (file)
@@ -1,7 +1,6 @@
 <turbo-frame id="pagination" target="_top" data-turbo="false">
   <%= render "shared/pagination",
 <turbo-frame id="pagination" target="_top" data-turbo="false">
   <%= render "shared/pagination",
-             :newer_key => "traces.page.newer",
-             :older_key => "traces.page.older",
+             :translation_scope => "shared.pagination.traces",
              :newer_id => @newer_traces_id,
              :older_id => @older_traces_id %>
 
              :newer_id => @newer_traces_id,
              :older_id => @older_traces_id %>
 
@@ -12,8 +11,7 @@
   </table>
 
   <%= render "shared/pagination",
   </table>
 
   <%= render "shared/pagination",
-             :newer_key => "traces.page.newer",
-             :older_key => "traces.page.older",
+             :translation_scope => "shared.pagination.traces",
              :newer_id => @newer_traces_id,
              :older_id => @older_traces_id %>
 </turbo-frame>
              :newer_id => @newer_traces_id,
              :older_id => @older_traces_id %>
 </turbo-frame>
index de6feafa1e4d6ee695cedd90741ee9a34f67520a..b0b4fa13f3971988c3b812c492f18d0951192e87 100644 (file)
@@ -19,8 +19,7 @@
   </table>
 
   <%= render "shared/pagination",
   </table>
 
   <%= render "shared/pagination",
-             :newer_key => "user_blocks.blocks.newer",
-             :older_key => "user_blocks.blocks.older",
+             :translation_scope => "shared.pagination.user_blocks",
              :newer_id => @newer_user_blocks_id,
              :older_id => @older_user_blocks_id %>
 </turbo-frame>
              :newer_id => @newer_user_blocks_id,
              :older_id => @older_user_blocks_id %>
 </turbo-frame>
index 8a58a29b7f0d0204cf0cd5f8479fc7815d6c26d8..b09f99164074f96b0dc302c0b0932dcde35a08ff 100644 (file)
@@ -3,8 +3,7 @@
     <div class="row">
       <div class="col">
         <%= render "shared/pagination",
     <div class="row">
       <div class="col">
         <%= render "shared/pagination",
-                   :newer_key => "users.page.newer",
-                   :older_key => "users.page.older",
+                   :translation_scope => "shared.pagination.users",
                    :newer_id => @newer_users_id,
                    :older_id => @older_users_id %>
       </div>
                    :newer_id => @newer_users_id,
                    :older_id => @older_users_id %>
       </div>
@@ -32,8 +31,7 @@
     <div class="row">
       <div class="col">
         <%= render "shared/pagination",
     <div class="row">
       <div class="col">
         <%= render "shared/pagination",
-                   :newer_key => "users.page.newer",
-                   :older_key => "users.page.older",
+                   :translation_scope => "shared.pagination.users",
                    :newer_id => @newer_users_id,
                    :older_id => @older_users_id %>
       </div>
                    :newer_id => @newer_users_id,
                    :older_id => @older_users_id %>
       </div>
index 083c2e42c84d3e7a41186bb1dbe0fb7dd9609333..97d5e6f003e5d18737ea5f92e07ef2ff6293af53 100644 (file)
@@ -535,8 +535,6 @@ en:
       no_entries: No diary entries
     page:
       recent_entries: "Recent diary entries"
       no_entries: No diary entries
     page:
       recent_entries: "Recent diary entries"
-      older_entries: Older Entries
-      newer_entries: Newer Entries
     edit:
       title: Edit Diary Entry
       marker_text: Diary entry location
     edit:
       title: Edit Diary Entry
       marker_text: Diary entry location
@@ -604,8 +602,6 @@ en:
       post: Post
       when: When
       comment: Comment
       post: Post
       when: When
       comment: Comment
-      newer_comments: "Newer Comments"
-      older_comments: "Older Comments"
     new:
       heading: Add a comment to the following diary entry discussion?
   doorkeeper:
     new:
       heading: Add a comment to the following diary entry discussion?
   doorkeeper:
@@ -1482,8 +1478,6 @@ en:
         ignored: Ignored
         open: Open
         resolved: Resolved
         ignored: Ignored
         open: Open
         resolved: Resolved
-      older_issues: Older Issues
-      newer_issues: Newer Issues
     show:
       title: "%{status} Issue #%{issue_id}"
       reports:
     show:
       title: "%{status} Issue #%{issue_id}"
       reports:
@@ -1895,6 +1889,25 @@ en:
       edit: Edit
       preview: Preview
       help: Help
       edit: Edit
       preview: Preview
       help: Help
+    pagination:
+      diary_comments:
+        older: Older Comments
+        newer: Newer Comments
+      diary_entries:
+        older: Older Entries
+        newer: Newer Entries
+      issues:
+        older: Older Issues
+        newer: Newer Issues
+      traces:
+        older: Older Traces
+        newer: Newer Traces
+      user_blocks:
+        older: Older Blocks
+        newer: Newer Blocks
+      users:
+        older: Older Users
+        newer: Newer Users
   site:
     about:
       heading_html: "%{copyright}OpenStreetMap %{br} contributors"
   site:
     about:
       heading_html: "%{copyright}OpenStreetMap %{br} contributors"
@@ -2537,9 +2550,6 @@ en:
       my_traces: "My Traces"
       traces_from: "Public Traces from %{user}"
       remove_tag_filter: "Remove Tag Filter"
       my_traces: "My Traces"
       traces_from: "Public Traces from %{user}"
       remove_tag_filter: "Remove Tag Filter"
-    page:
-      older: "Older Traces"
-      newer: "Newer Traces"
     destroy:
       scheduled_for_deletion: "Trace scheduled for deletion"
     offline_warning:
     destroy:
       scheduled_for_deletion: "Trace scheduled for deletion"
     offline_warning:
@@ -2793,8 +2803,6 @@ en:
       summary_no_ip_html: "%{name} created on %{date}"
       empty: No matching users found
     page:
       summary_no_ip_html: "%{name} created on %{date}"
       empty: No matching users found
     page:
-      older: "Older Users"
-      newer: "Newer Users"
       found_users:
         one: "%{count} user found"
         other: "%{count} users found"
       found_users:
         one: "%{count} user found"
         other: "%{count} users found"
@@ -2929,8 +2937,6 @@ en:
       reason: "Reason for block"
       status: "Status"
       revoker_name: "Revoked by"
       reason: "Reason for block"
       status: "Status"
       revoker_name: "Revoked by"
-      older: "Older Blocks"
-      newer: "Newer Blocks"
     navigation:
       all_blocks: "All Blocks"
       blocks_on_me: "Blocks on Me"
     navigation:
       all_blocks: "All Blocks"
       blocks_on_me: "Blocks on Me"
index 4d6d9519bf725215efa722c30632cda810d3863f..eae3322ff56c7c308f890f6da2ccab533c0dc016 100644 (file)
@@ -183,7 +183,7 @@ class IssuesTest < ApplicationSystemTestCase
     end
 
     # Second Page
     end
 
     # Second Page
-    click_on I18n.t("issues.page.older_issues")
+    click_on "Older Issues"
     assert_no_content I18n.t("issues.page.user_not_found")
     assert_no_content I18n.t("issues.page.issues_not_found")
     4.upto(8).each do |n|
     assert_no_content I18n.t("issues.page.user_not_found")
     assert_no_content I18n.t("issues.page.issues_not_found")
     4.upto(8).each do |n|
@@ -194,7 +194,7 @@ class IssuesTest < ApplicationSystemTestCase
     end
 
     # Back to First Page
     end
 
     # Back to First Page
-    click_on I18n.t("issues.page.newer_issues")
+    click_on "Newer Issues"
     assert_no_content I18n.t("issues.page.user_not_found")
     assert_no_content I18n.t("issues.page.issues_not_found")
     4.upto(8).each do |n|
     assert_no_content I18n.t("issues.page.user_not_found")
     assert_no_content I18n.t("issues.page.issues_not_found")
     4.upto(8).each do |n|