From fe104aa2c52f61cd8555fbc98c20501f50f4aae8 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sat, 25 Jul 2026 17:45:34 +0200 Subject: Extract admin strings to i18n: revisions, page_translations, and menu items, --- app/views/menu_items/edit.html.erb | 12 +++--- app/views/menu_items/index.html.erb | 10 ++--- app/views/menu_items/new.html.erb | 12 +++--- app/views/page_translations/edit.html.erb | 32 +++++++-------- app/views/page_translations/show.html.erb | 18 ++++----- app/views/revisions/diff.html.erb | 66 +++++++++++++++---------------- app/views/revisions/index.html.erb | 36 ++++++++--------- app/views/revisions/show.html.erb | 22 +++++------ 8 files changed, 103 insertions(+), 105 deletions(-) (limited to 'app/views') diff --git a/app/views/menu_items/edit.html.erb b/app/views/menu_items/edit.html.erb index 89854c93..0652dc78 100644 --- a/app/views/menu_items/edit.html.erb +++ b/app/views/menu_items/edit.html.erb @@ -1,25 +1,25 @@ -

Edit Menu Item

+

<%= t(".title") %>

<%= form_for @menu_item do |f| %>
-
Search
+
<%= t("admin.common.search") %>
<%= text_field_tag :menu_search_term %>
-
Node Id
+
<%= MenuItem.human_attribute_name(:node_id) %>
<%= f.text_field :node_id %>
-
Path
+
<%= MenuItem.human_attribute_name(:path) %>
<%= f.text_field :path %>
-
Title
+
<%= MenuItem.human_attribute_name(:title) %>
<%= f.text_field :title %>
-
<%= f.submit 'Update' %>
+
<%= f.submit t("admin.common.update") %>
<% end %>
diff --git a/app/views/menu_items/index.html.erb b/app/views/menu_items/index.html.erb index 591eb68d..cdc60c63 100644 --- a/app/views/menu_items/index.html.erb +++ b/app/views/menu_items/index.html.erb @@ -1,7 +1,7 @@ -

Menu Items

+

<%= t(".title") %>

<%= link_to new_menu_item_path, class: 'action_button' do %> - <%= icon("plus", library: "tabler", "aria-hidden": true) %> Create menu item + <%= icon("plus", library: "tabler", "aria-hidden": true) %> <%= t(".create_item") %> <% end %> @@ -11,11 +11,11 @@
- + diff --git a/app/views/menu_items/new.html.erb b/app/views/menu_items/new.html.erb index 408ba7bd..713ac967 100644 --- a/app/views/menu_items/new.html.erb +++ b/app/views/menu_items/new.html.erb @@ -1,20 +1,20 @@ -

Add Menu Item

+

<%= t(".title") %>

<%= form_for @menu_item do |f| %> -
Search
+
<%= t("admin.common.search") %>
<%= text_field_tag :menu_search_term %>
-
Node Id
+
<%= MenuItem.human_attribute_name(:node_id) %>
<%= f.text_field :node_id %>
-
Path
+
<%= MenuItem.human_attribute_name(:path) %>
<%= f.text_field :path %>
-
Title
+
<%= MenuItem.human_attribute_name(:title) %>
<%= f.text_field :title %>
-
<%= f.submit 'Create' %>
+
<%= f.submit t("admin.common.create") %>
<% end %> diff --git a/app/views/page_translations/edit.html.erb b/app/views/page_translations/edit.html.erb index ac91d22c..f398a544 100644 --- a/app/views/page_translations/edit.html.erb +++ b/app/views/page_translations/edit.html.erb @@ -1,22 +1,20 @@
- Editing the <%= @locale.to_s.upcase %> translation of <%= title_for_node(@node) %>. + <%= t(".editing_prefix") %> <%= @locale.to_s.upcase %> <%= t(".translation_of") %> <%= title_for_node(@node) %>.
-

<%= link_to 'View revision history', node_revisions_path(@node, :locale => @locale) %>

+

<%= link_to t("page_translations.revision_history_link"), node_revisions_path(@node, :locale => @locale) %>

- Metadata such as images, tags, template, and author belong to the page - as a whole, not to a single translation — change those from the - <%= link_to 'default-locale editor', edit_node_path(@node) %>. + <%= t(".metadata_hint_prefix") %> <%= link_to t(".metadata_hint_link"), edit_node_path(@node) %>.

- <%= button_to 'Unlock + Back', unlock_node_path(@node), method: :put, + <%= button_to t("nodes.edit.unlock_back"), unlock_node_path(@node), method: :put, form: { class: 'button_to state_changing' }, disabled: @node.autosave.present? %> - <%= submit_tag "Save #{@locale.to_s.upcase} translation", form: "translation_edit_form" %> - <%= submit_tag "Save + Unlock + Exit", name: "unlock_exit", form: "translation_edit_form" %> - <%= link_to "Preview ↗", preview_page_path(@page, :locale => @locale), target: "_blank", rel: "noopener", class: "preview_link" %> + <%= submit_tag t(".save_translation", :lang => @locale.to_s.upcase), form: "translation_edit_form" %> + <%= submit_tag t("nodes.edit.save_unlock_exit"), name: "unlock_exit", form: "translation_edit_form" %> + <%= link_to t("nodes.edit.preview"), preview_page_path(@page, :locale => @locale), target: "_blank", rel: "noopener", class: "preview_link" %>
@@ -32,23 +30,23 @@ <%= form_with url: node_translation_path(@node, @locale), method: :patch, local: true, id: "translation_edit_form", data: { autosave_url: autosave_node_translation_path(@node, @locale), show_url: node_path(@node) } do |f| %>
-
Title
+
<%= Page.human_attribute_name(:title) %>
<%= text_field_tag "page[title]", @translation&.title %>
-
Abstract
+
<%= Page.human_attribute_name(:abstract) %>
<%= text_area_tag "page[abstract]", @translation&.abstract %>
-
Body
+
<%= Page.human_attribute_name(:body) %>
- -
@@ -59,7 +57,7 @@
diff --git a/app/views/page_translations/show.html.erb b/app/views/page_translations/show.html.erb index c4091fc3..0fbcd0b6 100644 --- a/app/views/page_translations/show.html.erb +++ b/app/views/page_translations/show.html.erb @@ -1,29 +1,29 @@ -

Compare — <%= title_for_node(@node) %>

+

<%= t(".title") %> — <%= title_for_node(@node) %>

-

<%= link_to 'View revision history', node_revisions_path(@node, :locale => @locale) %>

+

<%= link_to t("page_translations.revision_history_link"), node_revisions_path(@node, :locale => @locale) %>

<%= @locale.to_s.upcase %>

-
Title
+
<%= Page.human_attribute_name(:title) %>
<%= @translation&.title %>
-
Abstract
+
<%= Page.human_attribute_name(:abstract) %>
<%= sanitize(@translation&.abstract.to_s) %>
-
Body
+
<%= Page.human_attribute_name(:body) %>
<%= sanitize(@translation&.body.to_s) %>
-

<%= I18n.default_locale.to_s.upcase %> (default)

-
Title
+

<%= I18n.default_locale.to_s.upcase %> (<%= t(".default_marker") %>)

+
<%= Page.human_attribute_name(:title) %>
<%= @default_translation&.title %>
-
Abstract
+
<%= Page.human_attribute_name(:abstract) %>
<%= sanitize(@default_translation&.abstract.to_s) %>
-
Body
+
<%= Page.human_attribute_name(:body) %>
<%= sanitize(@default_translation&.body.to_s) %>
diff --git a/app/views/revisions/diff.html.erb b/app/views/revisions/diff.html.erb index 7e7b729e..1318bd37 100644 --- a/app/views/revisions/diff.html.erb +++ b/app/views/revisions/diff.html.erb @@ -1,18 +1,18 @@ -

Revisions#diff

+

<%= t(".title") %>

- <%= link_to 'Revisions', node_revisions_path(@node) %> + <%= link_to t(".revisions_link"), node_revisions_path(@node) %>

- Comparing <%= describe_page_reference(params[:start_revision]) %> - against <%= describe_page_reference(params[:end_revision]) %> - — showing the <%= @locale.to_s.upcase %> translation + <%= t(".comparing") %> <%= describe_page_reference(params[:start_revision]) %> + <%= t(".against") %> <%= describe_page_reference(params[:end_revision]) %> + <%= t(".showing_prefix") %> <%= @locale.to_s.upcase %> <%= t(".translation_suffix") %>

<% if @locale_summary.size > 1 %>

- Locale: + <%= t("revisions.locale_label") %> <% @locale_summary.each_with_index do |s, i| %> <%= " · ".html_safe if i > 0 %> <% label = "#{s[:locale].to_s.upcase}#{' *' if s[:changed]}" %> @@ -23,21 +23,21 @@ <% end %> <% end %>

-

* has a difference between these two versions.

+

<%= t(".changed_hint") %>

<% end %>

- View: + <%= t(".view_label") %> <% if @diff_view == :inline %> - Inline + <%= t("revisions.inline") %> <% else %> - <%= link_to 'Inline', diff_node_revisions_path(@node, start_revision: params[:start_revision], end_revision: params[:end_revision], view: 'inline', locale: @locale) %> + <%= link_to t("revisions.inline"), diff_node_revisions_path(@node, start_revision: params[:start_revision], end_revision: params[:end_revision], view: 'inline', locale: @locale) %> <% end %> · <% if @diff_view == :side_by_side %> - Side by side + <%= t("revisions.side_by_side") %> <% else %> - <%= link_to 'Side by side', diff_node_revisions_path(@node, start_revision: params[:start_revision], end_revision: params[:end_revision], view: 'side_by_side', locale: @locale) %> + <%= link_to t("revisions.side_by_side"), diff_node_revisions_path(@node, start_revision: params[:start_revision], end_revision: params[:end_revision], view: 'side_by_side', locale: @locale) %> <% end %>

@@ -49,17 +49,17 @@ <%= select_tag :end_revision, options_for_select(@node.pages.map{|x| x.revision}, params[:end_revision].to_i) %> <%= hidden_field_tag :view, @diff_view %> <%= hidden_field_tag :locale, @locale %> - <%= submit_tag 'Diff' %> + <%= submit_tag t(".diff_button") %> <% end %> <% else %> -

<%= link_to 'Compare two numbered revisions instead', node_revisions_path(@node) %>

+

<%= link_to t(".compare_numbered"), node_revisions_path(@node) %>

<% end %> <% if @available_layer_pairs.present? %>
<% @available_layer_pairs.each do |pair| %> <% next if [params[:start_revision].to_s, params[:end_revision].to_s].sort == pair.map(&:to_s).sort %> - <%= button_to "Diff #{pair.first.to_s.capitalize} vs. #{pair.last.to_s.capitalize}", + <%= button_to t("nodes.show.diff_layers", :from => t("nodes.show.layer_#{pair.first}"), :to => t("nodes.show.layer_#{pair.last}")), diff_node_revisions_path(@node), method: :get, params: { start_revision: pair.first, end_revision: pair.last, view: @diff_view, locale: @locale }, @@ -68,9 +68,9 @@ <% if !@locked_by_other && (@node.autosave || @node.draft) %> <%= button_to revert_node_path(@node), method: :put, params: { return_to: request.fullpath }, - form: { data: { confirm: "This cannot be undone. Continue?" }, class: 'button_to destructive' } do %> + form: { data: { confirm: t("admin.common.confirm_irreversible") }, class: 'button_to destructive' } do %> <%= icon("trash", library: "tabler", "aria-hidden": true) %> - <%= @node.draft && !@node.autosave ? "Destroy Draft" : "Discard Autosave" %> + <%= @node.draft && !@node.autosave ? t("nodes.show.destroy_draft") : t("nodes.show.discard_autosave") %> <% end %> <% end %>
@@ -80,34 +80,34 @@ <% if @diff_view == :side_by_side %>
-

Title

+

<%= Page.human_attribute_name(:title) %>

<%= raw @diff[:title][0] %>

-

Abstract

+

<%= Page.human_attribute_name(:abstract) %>

<%= raw @diff[:abstract][0] %>

-

Body

+

<%= Page.human_attribute_name(:body) %>

<%= raw @diff[:body][0] %>
-

Title

+

<%= Page.human_attribute_name(:title) %>

<%= raw @diff[:title][1] %>

-

Abstract

+

<%= Page.human_attribute_name(:abstract) %>

<%= raw @diff[:abstract][1] %>

-

Body

+

<%= Page.human_attribute_name(:body) %>

<%= raw @diff[:body][1] %>
<% else %> -

Title

+

<%= Page.human_attribute_name(:title) %>

<%= raw @diff[:title] %>

-

Abstract

+

<%= Page.human_attribute_name(:abstract) %>

<%= raw @diff[:abstract] %>

-

Body

+

<%= Page.human_attribute_name(:body) %>

<%= raw @diff[:body] %> <% end %> -

Tags

+

<%= Page.human_attribute_name(:tag_list) %>

<% if @diff[:tags][:added].empty? && @diff[:tags][:removed].empty? %> -

No change.

+

<%= t(".no_change") %>

<% else %> <% end %> -

Template

+

<%= Page.human_attribute_name(:template_name) %>

<% if @diff[:template_name][:changed] %> -

<%= @diff[:template_name][:from] || '(none)' %> <%= @diff[:template_name][:to] || '(none)' %>

+

<%= @diff[:template_name][:from] || t(".none_marker") %> <%= @diff[:template_name][:to] || t(".none_marker") %>

<% else %> -

No change.

+

<%= t(".no_change") %>

<% end %> -

Assets

+

<%= Page.human_attribute_name(:assets) %>

<% if @diff[:assets][:added].empty? && @diff[:assets][:removed].empty? %> -

No change.

+

<%= t(".no_change") %>

<% else %> - - - - - - + + + + + + @@ -53,11 +53,11 @@ - + <% end %> @@ -73,9 +73,9 @@ var label = document.getElementById('diff_selection_label'); if (start && end) { - label.textContent = start.value + ' against ' + end.value; + label.textContent = start.value + ' ' + label.dataset.against + ' ' + end.value; } else if (start || end) { - label.textContent = (start || end).value + ' selected'; + label.textContent = (start || end).value + ' ' + label.dataset.selected; } else { label.textContent = ''; } diff --git a/app/views/revisions/show.html.erb b/app/views/revisions/show.html.erb index 64bc0eea..a39071c6 100644 --- a/app/views/revisions/show.html.erb +++ b/app/views/revisions/show.html.erb @@ -1,39 +1,39 @@ <% translation = @page.translations.find_by(:locale => @locale) %>
-

Revision <%= @page.revision %>: <%= translation&.title %> (<%= @locale.to_s.upcase %>)

+

<%= t(".title", :rev => @page.revision) %>: <%= translation&.title %> (<%= @locale.to_s.upcase %>)

-
Actions
+
<%= t("admin.columns.actions") %>
- <%= link_to 'Show all revisions', node_revisions_path(@node, :locale => @locale) %> + <%= link_to t(".show_all"), node_revisions_path(@node, :locale => @locale) %>
-
Path
+
<%= t("admin.columns.path") %>
<%= @page.public_link %>
-
Author
+
<%= t("admin.columns.author") %>
<%= @page.user.try(:login) %>
-
Editor
+
<%= t("admin.columns.editor") %>
<%= @page.editor.try(:login) %>
-
Last updated
+
<%= t("nodes.show.last_updated") %>
<%= @page.updated_at %>
-
Published at
+
<%= t("nodes.show.published_at") %>
<%= @page.published_at %>
-
Title
+
<%= Page.human_attribute_name(:title) %>
<%= translation&.title %>
-
Abstract
+
<%= Page.human_attribute_name(:abstract) %>
<%= translation&.abstract %>
-
Body
+
<%= Page.human_attribute_name(:body) %>
<%= raw translation&.body %>
-- cgit v1.3
FirstLastRev.TitleEditorDate<%= t(".first") %><%= t(".last") %><%= t("admin.columns.rev") %><%= t("admin.columns.title") %><%= t("admin.columns.editor") %><%= t("admin.columns.date") %>
- <%= button_to 'Diff revisions', diff_node_revisions_path(@node), + <%= button_to t(".diff_revisions"), diff_node_revisions_path(@node), method: :post, params: { locale: @locale }, form: { id: 'diff_form', class: 'button_to computation' }, disabled: true %> - - - + " data-selected="<%= t(".selected_word") %>"> + +
<%= page.translations.find_by(:locale => @locale)&.title || "—" %> <%= page.editor.try(:login) %> <%= page.updated_at %><%= link_to 'show', node_revision_path(@node, page, :locale => @locale) %><%= link_to t(".show_link"), node_revision_path(@node, page, :locale => @locale) %> - <%= button_to 'restore', restore_node_revision_path(@node, page), + <%= button_to t(".restore_link"), restore_node_revision_path(@node, page), method: :put, - form: { data: { confirm: "Restore this revision?" }, class: 'button_to state_changing' } %> + form: { data: { confirm: t(".confirm_restore") }, class: 'button_to state_changing' } %>