From ed32bc6902ab634451539770bcd910662212e01a Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sat, 25 Jul 2026 02:56:49 +0200 Subject: Extract admin strings to i18n: users and tags clusters --- app/views/tags/index.html.erb | 4 ++-- app/views/users/_user.html.erb | 4 ++-- app/views/users/edit.html.erb | 10 +++++----- app/views/users/index.html.erb | 12 ++++++------ app/views/users/new.html.erb | 14 +++++++------- app/views/users/show.html.erb | 12 ++++++------ config/locales/de.yml | 26 +++++++++++++++++++++----- config/locales/en.yml | 26 +++++++++++++++++++++----- test/controllers/users_controller_test.rb | 2 +- 9 files changed, 71 insertions(+), 39 deletions(-) diff --git a/app/views/tags/index.html.erb b/app/views/tags/index.html.erb index b962b65b..b7b9660b 100644 --- a/app/views/tags/index.html.erb +++ b/app/views/tags/index.html.erb @@ -1,5 +1,5 @@ -

Tags

+

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

<% @tags.each do |tag| %> <%= link_to tag, tag_path(tag.name.parameterize) %> -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/users/_user.html.erb b/app/views/users/_user.html.erb index 3a88f5e2..9c6466a2 100644 --- a/app/views/users/_user.html.erb +++ b/app/views/users/_user.html.erb @@ -8,8 +8,8 @@ <%= button_to user_path(user), method: :delete, - form: { data: { confirm: "Do you really want to destroy user #{user.login}?" }, class: 'button_to destructive' } do %> - <%= icon("trash", library: "tabler", "aria-hidden": true) %> Destroy + form: { data: { confirm: t(".confirm_destroy", :login => user.login) }, class: 'button_to destructive' } do %> + <%= icon("trash", library: "tabler", "aria-hidden": true) %> <%= t("admin.common.destroy") %> <% end %> <% end %> diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index ea5e7dec..4f1a22b8 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -9,20 +9,20 @@
<%= form_for @user do |f| %>
-
<%= t(".login") %>
+
<%= t("users.labels.login") %>
<%= f.text_field :login, :autocomplete => "username" %>
-
<%= t(".email") %>
+
<%= t("users.labels.email") %>
<%= f.text_field :email %>
-
<%= t(".password") %>
+
<%= t("users.labels.password") %>
<%= f.password_field :password, :autocomplete => "new-password" %>
-
<%= t(".confirm") %>
+
<%= t("users.labels.confirm") %>
<%= f.password_field :password_confirmation, :autocomplete => "new-password" %>
<% if current_user.admin? %> -
<%= t(".admin") %>
+
<%= t("users.labels.admin") %>
<%= f.check_box :admin %>
<% end %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 4f5266d8..0a003cb1 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1,10 +1,10 @@ -

Admins

+

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

<%= link_to new_user_path(admin: true), class: 'action_button' do %> - <%= icon("plus", library: "tabler", "aria-hidden": true) %> Create admin user + <%= icon("plus", library: "tabler", "aria-hidden": true) %> <%= t(".create_admin") %> <% end %> - + @@ -12,13 +12,13 @@ <%= render :partial => "user", :locals => {:users => @users[:admin] ||= []} %>
Login<%= t("users.labels.login") %>
-

Users

+

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

<%= link_to new_user_path, class: 'action_button' do %> - <%= icon("plus", library: "tabler", "aria-hidden": true) %> Create user + <%= icon("plus", library: "tabler", "aria-hidden": true) %> <%= t(".create_user") %> <% end %> - + diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 8ae993c5..776e6e96 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -1,4 +1,4 @@ -

Create new user

+

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

<% if @user.errors.any? %>
@@ -9,23 +9,23 @@
<%= form_for @user do |f| %>
-
Login
+
<%= t("users.labels.login") %>
<%= f.text_field :login %>
-
E-Mail
+
<%= t("users.labels.email") %>
<%= f.text_field :email %>
-
Password
+
<%= t("users.labels.password") %>
<%= f.password_field :password %>
-
Confirm
+
<%= t("users.labels.confirm") %>
<%= f.password_field :password_confirmation %>
-
Admin?
+
<%= t("users.labels.admin") %>
<%= f.check_box :admin %>
-
<%= f.submit "Create" %>
+
<%= f.submit t("admin.common.create") %>
<% end %>
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 08eb52ec..44976800 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -2,24 +2,24 @@

<%= @user.login %>

-
Actions
+
<%= t("admin.columns.actions") %>
<%= link_to edit_user_path(@user), class: 'action_button' do %> - <%= icon("edit", library: "tabler", "aria-hidden": true) %> Edit + <%= icon("edit", library: "tabler", "aria-hidden": true) %> <%= t("admin.common.edit") %> <% end %>
-
Login
+
<%= t("users.labels.login") %>
<%= @user.login %>
-
E-Mail
+
<%= t("users.labels.email") %>
<%= @user.email %>
-
Admin?
-
<%= @user.admin ? "yes" : "no" %>
+
<%= t("users.labels.admin") %>
+
<%= @user.admin ? t("admin.common.yes") : t("admin.common.no") %>
diff --git a/config/locales/de.yml b/config/locales/de.yml index 3be58e54..ab7852ce 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -84,6 +84,10 @@ de: container_aria_label: "Seitennavigation" page_aria_label: "Seite %{page}" + tags: + index: + title: "Tags" + node_actions: heading: "Letzte Änderungen" show_all: "Alle Einträge zeigen" @@ -172,11 +176,6 @@ de: edit: my_account: "Mein Konto" edit_user: "Benutzer „%{login}“ bearbeiten" - login: "Anmeldename" - email: "E-Mail" - password: "Passwort" - confirm: "bestätigen" - admin: "Admin?" update: "Aktualisieren" enabled: "Aktiviert." not_enrolled: "Nicht eingerichtet." @@ -187,6 +186,21 @@ de: disable_second_factor: "Zweiten Faktor entfernen" reset_second_factor: "Zweiten Faktor zurücksetzen" reset_confirm: "Zweiten Faktor von %{login} zurücksetzen? Die Anmeldung ist danach nur mit Passwort möglich." + labels: + login: "Anmeldename" + email: "E-Mail" + password: "Passwort" + confirm: "bestätigen" + admin: "Admin?" + user: + confirm_destroy: "Benutzer %{login} wirklich löschen?" + index: + admins: "Admins" + create_admin: "Admin-Benutzer anlegen" + users: "Benutzer" + create_user: "Benutzer anlegen" + new: + title: "Neuen Benutzer anlegen" admin: common: @@ -198,6 +212,8 @@ de: confirm_irreversible: "Das kann nicht rückgängig gemacht werden. Fortfahren?" toggle_preview: "Live-Vorschau umschalten" force_render: "Vorschau neu rendern" + "yes": "ja" + "no": "nein" columns: id: "ID" title: "Titel" diff --git a/config/locales/en.yml b/config/locales/en.yml index a15c7dd9..cb75693b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -36,6 +36,10 @@ en: container_aria_label: "Pagination" page_aria_label: "Page %{page}" + tags: + index: + title: "Tags" + node_actions: heading: "Action log" show_all: "Show all entries" @@ -124,11 +128,6 @@ en: edit: my_account: "My account" edit_user: "Edit user “%{login}”" - login: "login" - email: "e-mail" - password: "password" - confirm: "confirm" - admin: "admin?" update: "Update" enabled: "Enabled." not_enrolled: "Not enrolled." @@ -139,6 +138,21 @@ en: disable_second_factor: "Disable second factor" reset_second_factor: "Reset second factor" reset_confirm: "Reset %{login}'s second factor? They will log in with password only afterwards." + labels: + login: "login" + email: "e-mail" + password: "password" + confirm: "confirm" + admin: "admin?" + user: + confirm_destroy: "Do you really want to destroy user %{login}?" + index: + admins: "Admins" + create_admin: "Create admin user" + users: "Users" + create_user: "Create user" + new: + title: "Create new user" admin: common: @@ -150,6 +164,8 @@ en: confirm_irreversible: "This cannot be undone. Continue?" toggle_preview: "Toggle live preview" force_render: "Force preview render" + "yes": "yes" + "no": "no" columns: id: "ID" title: "Title" diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index 14f12b52..dcd8f259 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb @@ -13,7 +13,7 @@ class UsersControllerTest < ActionController::TestCase login_as :aaron get :index assert_response :success - assert_select "button[type=submit]", "Destroy" + assert_select "button[type=submit]", I18n.t("admin.common.destroy") assert_select "a", "show" end -- cgit v1.3
Login<%= t("users.labels.login") %>