From 0a5d7806700bb3154529b99abc75d37ccc46faff Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sat, 25 Jul 2026 02:23:13 +0200 Subject: Extract admin strings to i18n: the nodes cluster --- app/views/nodes/show.html.erb | 148 +++++++++++++++++++++--------------------- 1 file changed, 73 insertions(+), 75 deletions(-) (limited to 'app/views/nodes/show.html.erb') diff --git a/app/views/nodes/show.html.erb b/app/views/nodes/show.html.erb index e37f5034..a337b555 100644 --- a/app/views/nodes/show.html.erb +++ b/app/views/nodes/show.html.erb @@ -2,24 +2,24 @@

<%= title_for_node(@node) %> (<%= I18n.default_locale.to_s.upcase %>)

-
Status
+
<%= t(".status") %>
- Head - <%= @node.head ? "#{@node.head.title} (rev #{@node.head.revision}, #{@node.head.updated_at})" : "none — never published" %> + <%= t(".head") %> + <%= @node.head ? t(".head_line", :title => @node.head.title, :rev => @node.head.revision, :time => @node.head.updated_at) : t(".never_published") %>
- Draft - <%= @node.draft ? "#{@node.draft.title} (rev #{@node.draft.revision}, saved #{@node.draft.updated_at})" : "none" %> + <%= t(".draft") %> + <%= @node.draft ? t(".draft_line", :title => @node.draft.title, :rev => @node.draft.revision, :time => @node.draft.updated_at) : t(".none") %>
- Autosave - <%= @node.autosave ? "#{@node.autosave.title} (unsaved, #{@node.autosave.updated_at})" : "none" %> + <%= t(".autosave") %> + <%= @node.autosave ? t(".autosave_line", :title => @node.autosave.title, :time => @node.autosave.updated_at) : t(".none") %>
- <% edit_label = @node.autosave ? "Continue Editing" : (@node.draft ? "Edit Draft" : "Edit") %> + <% edit_label = @node.autosave ? t(".continue_editing") : (@node.draft ? t(".edit_draft") : t(".lock_edit")) %>
<% if locked_by_other %> @@ -27,17 +27,17 @@ <% else %> <%= link_to edit_node_path(@node), class: "action_button" do %> <%= icon("edit", library: "tabler", "aria-hidden": true) %> - <%= @node.autosave ? "Continue Editing" : (@node.draft ? "Edit Draft" : "Lock + Edit") %> + <%= edit_label %> <% end %> <% if !@node.draft && !@node.autosave %> - Nothing pending — this will start a fresh draft. + <%= t(".fresh_draft_hint") %> <% end %> <% end %>
<% @node.available_layer_pairs.each do |pair| %>
- <%= button_to "Diff #{pair.first.to_s.capitalize} vs. #{pair.last.to_s.capitalize}", + <%= button_to t(".diff_layers", :from => t(".layer_#{pair.first}"), :to => t(".layer_#{pair.last}")), diff_node_revisions_path(@node), method: :get, params: { start_revision: pair.first, end_revision: pair.last }, @@ -48,26 +48,26 @@ <% unless locked_by_other %> <% if @node.draft && !@node.autosave && !@node.in_trash? && !@node.trash_node? %>
- <%= button_to 'Publish', publish_node_path(@node), method: :put, - form: { data: { confirm: "Publish this draft?" }, class: 'button_to state_changing' } %> + <%= button_to t(".publish"), publish_node_path(@node), method: :put, + form: { data: { confirm: t(".confirm_publish") }, class: 'button_to state_changing' } %>
<% end %> <% if @node.autosave || (@node.draft && @node.head) %>
<%= button_to revert_node_path(@node), method: :put, params: { return_to: request.path }, - 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(".destroy_draft") : t(".discard_autosave") %> <% end %>
<% end %> <% unless @node.trash_node? || @node.in_trash? || @node.root? %>
<%= button_to trash_node_path(@node), method: :put, - form: { data: { confirm: "Move this page and everything beneath it to the Trash? All published content in it will go offline." }, class: 'button_to destructive' } do %> + form: { data: { confirm: t(".confirm_trash") }, class: 'button_to destructive' } do %> <%= icon("trash", library: "tabler", "aria-hidden": true) %> - Move to Trash + <%= t(".move_to_trash") %> <% end %>
<% end %> @@ -75,79 +75,77 @@
<% if locked_by_other %> - Locked — see People below to unlock before editing, publishing, or discarding. + <%= t(".locked_hint") %> <% end %>
<% if @node.in_trash? %> -
Trash
+
<%= t(".trash") %>
<% if (entry = @node.last_trash_entry) && entry.metadata.dig("path", "from") %>
- Was at + <%= t(".was_at") %> <%= entry.metadata.dig("path", "from") %>
<% end %>
- Restore to + <%= t(".restore_to") %> <% suggestion = @node.suggested_restore_parent %> <%= form_tag restore_from_trash_node_path(@node), :method => :put, :class => "aligned_action_row" do %>
<%= text_field_tag :restore_search_term, suggestion && (suggestion.head&.title || suggestion.draft&.title || suggestion.slug), - :placeholder => "Search for a new parent…" %> + :placeholder => t(".restore_placeholder") %>
<%= hidden_field_tag :parent_id, suggestion&.id %> - <%= submit_tag "Restore here", :class => "action_button action_button_no_margin_top" %> + <%= submit_tag t(".restore_here"), :class => "action_button action_button_no_margin_top" %> <% end %> - Restored pages come back unpublished. Republish each page deliberately. + <%= t(".restore_hint") %>
<% doomed_below = @node.descendants.count %> <%= button_to node_path(@node), method: :delete, - form: { data: { confirm: doomed_below > 0 ? - "Delete this page and the #{doomed_below} pages beneath it permanently? This cannot be undone." : - "Delete this page permanently? This cannot be undone." }, + form: { data: { confirm: t(".confirm_delete", :count => doomed_below) }, class: 'button_to destructive' } do %> <%= icon("trash-x", library: "tabler", "aria-hidden": true) %> - Delete permanently<%= " (including #{doomed_below} beneath)" if doomed_below > 0 %> + <%= t(".delete_permanently") %><%= " " + t(".including_beneath", :count => doomed_below) if doomed_below > 0 %> <% end %>
<% end %> -
Translations
+
<%= t(".translations") %>
- <% @translations.each do |t| %> + <% @translations.each do |translation| %>
- <%= t[:locale].to_s.upcase %> + <%= translation[:locale].to_s.upcase %>
- <% if t[:exists] %> - <%= link_to t[:title], node_translation_path(@node, t[:locale]) %> — updated <%= t[:updated_at] %> - <% if t[:outdated] %> - may be outdated + <% if translation[:exists] %> + <%= link_to translation[:title], node_translation_path(@node, translation[:locale]) %> <%= t(".updated", :time => translation[:updated_at]) %> + <% if translation[:outdated] %> + <%= t(".may_be_outdated") %> <% end %> <% else %> - Not yet translated. + <%= t(".not_yet_translated") %> <% end %> <% if locked_by_other %> - <%= t[:exists] ? "Lock + Edit" : "Create translation + Lock" %> + <%= translation[:exists] ? t(".lock_edit") : t(".create_translation") %> <% else %> - <%= link_to edit_node_translation_path(@node, t[:locale]), class: "action_button" do %> - <%= icon(t[:exists] ? "edit" : "language", library: "tabler", "aria-hidden": true) %> - <%= t[:exists] ? "Lock + Edit" : "Create translation + Lock" %> + <%= link_to edit_node_translation_path(@node, translation[:locale]), class: "action_button" do %> + <%= icon(translation[:exists] ? "edit" : "language", library: "tabler", "aria-hidden": true) %> + <%= translation[:exists] ? t(".lock_edit") : t(".create_translation") %> <% end %> - <% if t[:exists] %> - <%= button_to node_translation_path(@node, t[:locale]), method: :delete, - form: { data: { confirm: "This cannot be undone. Continue?" }, class: 'button_to destructive' } do %> + <% if translation[:exists] %> + <%= button_to node_translation_path(@node, translation[:locale]), method: :delete, + form: { data: { confirm: t("admin.common.confirm_irreversible") }, class: 'button_to destructive' } do %> <%= icon("trash", library: "tabler", "aria-hidden": true) %> - Destroy Translation + <%= t(".destroy_translation") %> <% end %> <% end %> <% end %> @@ -157,20 +155,20 @@
-
People
+
<%= t(".people") %>
- Author + <%= t(".author") %> <%= @page.user.try(:login) %>
- Editor + <%= t(".editor") %> <%= @page.editor.try(:login) %>
<% if @node.locked? %>
- Locked by + <%= t("admin.columns.locked_by") %> <%= @node.lock_owner.login %> <%= unlock_link %>
@@ -178,54 +176,54 @@
-
Dates
+
<%= t(".dates") %>
- Last updated + <%= t(".last_updated") %> <%= @page.updated_at %>
<% if @page.published_at.present? %>
- <%= @page.public? ? 'Published at' : 'Will publish at' %> + <%= @page.public? ? t(".published_at") : t(".will_publish_at") %> <%= @page.published_at %>
<% end %>
-
Links
+
<%= t(".links") %>
- Public + <%= t(".public") %> <%= link_to @page.public_link, content_url(@node.unique_path) %>
<% if @node.draft %>
- Admin Preview + <%= t(".admin_preview") %> <%= link_to preview_page_path(@node.draft), preview_page_path(@node.draft) %>
- Public Preview + <%= t(".public_preview") %> <% if @node.draft.preview_token.present? %>
<%= link_to shared_preview_path(token: @node.draft.preview_token), shared_preview_url(token: @node.draft.preview_token), target: "_blank", rel: "noopener" %> - <%= button_to 'Revoke', revoke_shared_preview_node_path(@node), method: :put, form: { data: { confirm: "Revoke this preview link? Anyone currently using it will immediately lose access." }, class: 'button_to state_changing' } %> + <%= button_to t(".revoke"), revoke_shared_preview_node_path(@node), method: :put, form: { data: { confirm: t(".confirm_revoke") }, class: 'button_to state_changing' } %>
<% else %> - <%= button_to 'Create public preview link', generate_shared_preview_node_path(@node), method: :put, form: { class: 'button_to state_changing' } %> + <%= button_to t(".create_preview_link"), generate_shared_preview_node_path(@node), method: :put, form: { class: 'button_to state_changing' } %> <% end %>
<% end %>
-
History
+
<%= t(".history") %>
- <%= pluralize(@node.pages.count, 'published revision', 'published revisions') %> + <%= t(".published_revisions", :count => @node.pages.count) %>
    <% @node.pages.order(:revision).each do |page| %> @@ -236,11 +234,11 @@ <% end %>
- +
-
Tags
+
<%= t(".tags") %>
<% if @page.tag_list.any? %>
    @@ -249,11 +247,11 @@ <% end %>
<% else %> - No tags. + <%= t(".no_tags") %> <% end %>
-
Attachments
+
<%= t(".attachments") %>
<% if @page.assets.any? %> <% headline_asset_id = @page.headline_asset&.id %> @@ -262,7 +260,7 @@
  • "> <%= link_to image_tag(asset.upload.url(:thumb)), asset_path(asset) %> <% if asset.id == headline_asset_id %> - + <%= icon("star", library: "tabler", "aria-hidden": true) %> <% end %> @@ -272,38 +270,38 @@ <% end %>

    <%= link_to new_asset_path(:node_id => @node.id), class: 'action_button' do %> - <%= icon("paperclip", library: "tabler", "aria-hidden": true) %> Upload new attachment + <%= icon("paperclip", library: "tabler", "aria-hidden": true) %> <%= t(".upload_attachment") %> <% end %> - To add or remove existing attachments, edit this node instead. + <%= t(".attachments_hint") %>

  • -
    Events
    +
    <%= t(".events") %>
      <% @node.events.order(:start_time).each do |event| %>
    • <%= event_schedule_text(event) %> - [<%= link_to 'show', event_path(event, return_to: request.path) %> - | <%= link_to 'edit', edit_event_path(event, return_to: request.path) %>] + [<%= link_to t(".show_link"), event_path(event, return_to: request.path) %> + | <%= link_to t(".edit_link"), edit_event_path(event, return_to: request.path) %>]
    • <% end %>
    <% mapping = default_event_tag_mapping(@page) %>

    <%= link_to new_event_path(node_id: @node.id, tag_list: mapping&.last, auto_tag_source: mapping&.first, return_to: request.path), class: 'action_button' do %> - <%= icon("calendar-plus", library: "tabler", "aria-hidden": true) %> Add event + <%= icon("calendar-plus", library: "tabler", "aria-hidden": true) %> <%= t(".add_event") %> <% end %>

    <% matches = matching_node_kinds(@node) %> <% if @node.children.any? || matches.any? %> -
    Children
    +
    <%= t(".children") %>
    <% if @node.children.any? %>
    - <%= pluralize(@node.children.count, 'child', 'children') %> + <%= t(".children_count", :count => @node.children.count) %>
      <% @node.children.order(:slug).each do |child| %>
    • <%= link_to (child.head&.title || child.draft&.title || child.slug), node_path(child) %>
    • @@ -317,7 +315,7 @@ <% link_params = { kind: kind } %> <% link_params[:parent_id] = @node.id if kind == "generic" %> <%= link_to new_node_path(link_params), class: 'action_button' do %> - <%= icon("text-plus", library: "tabler", "aria-hidden": true) %> Add child type <%= resolve_kind_text(config[:label]) %> + <%= icon("text-plus", library: "tabler", "aria-hidden": true) %> <%= t(".add_child", :kind => resolve_kind_text(config[:label])) %> <% end %> <% end %>

      @@ -325,10 +323,10 @@
    <% end %> -
    Abstract (<%= I18n.default_locale.to_s.upcase %>)
    +
    <%= t(".abstract_locale", :lang => I18n.default_locale.to_s.upcase) %>
    <%= sanitize(@page.abstract) %>
    -
    Body (<%= I18n.default_locale.to_s.upcase %>)
    +
    <%= t(".body_locale", :lang => I18n.default_locale.to_s.upcase) %>
    <%= sanitize(@page.body) %>
    -- cgit v1.3