diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-25 02:56:49 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-25 02:56:49 +0200 |
| commit | ed32bc6902ab634451539770bcd910662212e01a (patch) | |
| tree | 8fc514889c2f80052a3873753d9cb32bfa879bb7 | |
| parent | 0a5d7806700bb3154529b99abc75d37ccc46faff (diff) | |
Extract admin strings to i18n: users and tags clusters
| -rw-r--r-- | app/views/tags/index.html.erb | 4 | ||||
| -rw-r--r-- | app/views/users/_user.html.erb | 4 | ||||
| -rw-r--r-- | app/views/users/edit.html.erb | 10 | ||||
| -rw-r--r-- | app/views/users/index.html.erb | 12 | ||||
| -rw-r--r-- | app/views/users/new.html.erb | 14 | ||||
| -rw-r--r-- | app/views/users/show.html.erb | 12 | ||||
| -rw-r--r-- | config/locales/de.yml | 26 | ||||
| -rw-r--r-- | config/locales/en.yml | 26 | ||||
| -rw-r--r-- | 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 @@ | |||
| 1 | <h1>Tags</h1> | 1 | <h1><%= t(".title") %></h1> |
| 2 | 2 | ||
| 3 | <% @tags.each do |tag| %> | 3 | <% @tags.each do |tag| %> |
| 4 | <span><%= link_to tag, tag_path(tag.name.parameterize) %></span> | 4 | <span><%= link_to tag, tag_path(tag.name.parameterize) %></span> |
| 5 | <% end %> \ No newline at end of file | 5 | <% 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 @@ | |||
| 8 | </td> | 8 | </td> |
| 9 | <td> | 9 | <td> |
| 10 | <%= button_to user_path(user), method: :delete, | 10 | <%= button_to user_path(user), method: :delete, |
| 11 | form: { data: { confirm: "Do you really want to destroy user #{user.login}?" }, class: 'button_to destructive' } do %> | 11 | form: { data: { confirm: t(".confirm_destroy", :login => user.login) }, class: 'button_to destructive' } do %> |
| 12 | <%= icon("trash", library: "tabler", "aria-hidden": true) %> Destroy | 12 | <%= icon("trash", library: "tabler", "aria-hidden": true) %> <%= t("admin.common.destroy") %> |
| 13 | <% end %> | 13 | <% end %> |
| 14 | </td> | 14 | </td> |
| 15 | <% end %> | 15 | <% 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 @@ | |||
| 9 | <div id="admin_layout"> | 9 | <div id="admin_layout"> |
| 10 | <%= form_for @user do |f| %> | 10 | <%= form_for @user do |f| %> |
| 11 | <div id="content"> | 11 | <div id="content"> |
| 12 | <div class="layout_row_label"><%= t(".login") %></div> | 12 | <div class="layout_row_label"><%= t("users.labels.login") %></div> |
| 13 | <div class="layout_row_content"><%= f.text_field :login, :autocomplete => "username" %></div> | 13 | <div class="layout_row_content"><%= f.text_field :login, :autocomplete => "username" %></div> |
| 14 | 14 | ||
| 15 | <div class="layout_row_label"><%= t(".email") %></div> | 15 | <div class="layout_row_label"><%= t("users.labels.email") %></div> |
| 16 | <div class="layout_row_content"><%= f.text_field :email %></div> | 16 | <div class="layout_row_content"><%= f.text_field :email %></div> |
| 17 | 17 | ||
| 18 | <div class="layout_row_label"><%= t(".password") %></div> | 18 | <div class="layout_row_label"><%= t("users.labels.password") %></div> |
| 19 | <div class="layout_row_content"><%= f.password_field :password, :autocomplete => "new-password" %></div> | 19 | <div class="layout_row_content"><%= f.password_field :password, :autocomplete => "new-password" %></div> |
| 20 | 20 | ||
| 21 | <div class="layout_row_label"><%= t(".confirm") %></div> | 21 | <div class="layout_row_label"><%= t("users.labels.confirm") %></div> |
| 22 | <div class="layout_row_content"><%= f.password_field :password_confirmation, :autocomplete => "new-password" %></div> | 22 | <div class="layout_row_content"><%= f.password_field :password_confirmation, :autocomplete => "new-password" %></div> |
| 23 | 23 | ||
| 24 | <% if current_user.admin? %> | 24 | <% if current_user.admin? %> |
| 25 | <div class="layout_row_label"><%= t(".admin") %></div> | 25 | <div class="layout_row_label"><%= t("users.labels.admin") %></div> |
| 26 | <div class="layout_row_content"><%= f.check_box :admin %></div> | 26 | <div class="layout_row_content"><%= f.check_box :admin %></div> |
| 27 | <% end %> | 27 | <% end %> |
| 28 | 28 | ||
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 @@ | |||
| 1 | <h1>Admins</h1> | 1 | <h1><%= t(".admins") %></h1> |
| 2 | <%= link_to new_user_path(admin: true), class: 'action_button' do %> | 2 | <%= link_to new_user_path(admin: true), class: 'action_button' do %> |
| 3 | <%= icon("plus", library: "tabler", "aria-hidden": true) %> Create admin user | 3 | <%= icon("plus", library: "tabler", "aria-hidden": true) %> <%= t(".create_admin") %> |
| 4 | <% end %> | 4 | <% end %> |
| 5 | <table class="user_table"> | 5 | <table class="user_table"> |
| 6 | <tr class="header"> | 6 | <tr class="header"> |
| 7 | <th>Login</th> | 7 | <th><%= t("users.labels.login") %></th> |
| 8 | <th></th> | 8 | <th></th> |
| 9 | <th></th> | 9 | <th></th> |
| 10 | <th></th> | 10 | <th></th> |
| @@ -12,13 +12,13 @@ | |||
| 12 | <%= render :partial => "user", :locals => {:users => @users[:admin] ||= []} %> | 12 | <%= render :partial => "user", :locals => {:users => @users[:admin] ||= []} %> |
| 13 | </table> | 13 | </table> |
| 14 | 14 | ||
| 15 | <h1>Users</h1> | 15 | <h1><%= t(".users") %></h1> |
| 16 | <%= link_to new_user_path, class: 'action_button' do %> | 16 | <%= link_to new_user_path, class: 'action_button' do %> |
| 17 | <%= icon("plus", library: "tabler", "aria-hidden": true) %> Create user | 17 | <%= icon("plus", library: "tabler", "aria-hidden": true) %> <%= t(".create_user") %> |
| 18 | <% end %> | 18 | <% end %> |
| 19 | <table class="user_table"> | 19 | <table class="user_table"> |
| 20 | <tr class="header"> | 20 | <tr class="header"> |
| 21 | <th>Login</th> | 21 | <th><%= t("users.labels.login") %></th> |
| 22 | <th></th> | 22 | <th></th> |
| 23 | <th></th> | 23 | <th></th> |
| 24 | <th></th> | 24 | <th></th> |
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 @@ | |||
| 1 | <h1>Create new user</h1> | 1 | <h1><%= t(".title") %></h1> |
| 2 | 2 | ||
| 3 | <% if @user.errors.any? %> | 3 | <% if @user.errors.any? %> |
| 4 | <div class="error_messages"> | 4 | <div class="error_messages"> |
| @@ -9,23 +9,23 @@ | |||
| 9 | <div id="admin_layout"> | 9 | <div id="admin_layout"> |
| 10 | <%= form_for @user do |f| %> | 10 | <%= form_for @user do |f| %> |
| 11 | <div id="content"> | 11 | <div id="content"> |
| 12 | <div class="layout_row_label">Login</div> | 12 | <div class="layout_row_label"><%= t("users.labels.login") %></div> |
| 13 | <div class="layout_row_content"><%= f.text_field :login %></div> | 13 | <div class="layout_row_content"><%= f.text_field :login %></div> |
| 14 | 14 | ||
| 15 | <div class="layout_row_label">E-Mail</div> | 15 | <div class="layout_row_label"><%= t("users.labels.email") %></div> |
| 16 | <div class="layout_row_content"><%= f.text_field :email %></div> | 16 | <div class="layout_row_content"><%= f.text_field :email %></div> |
| 17 | 17 | ||
| 18 | <div class="layout_row_label">Password</div> | 18 | <div class="layout_row_label"><%= t("users.labels.password") %></div> |
| 19 | <div class="layout_row_content"><%= f.password_field :password %></div> | 19 | <div class="layout_row_content"><%= f.password_field :password %></div> |
| 20 | 20 | ||
| 21 | <div class="layout_row_label">Confirm</div> | 21 | <div class="layout_row_label"><%= t("users.labels.confirm") %></div> |
| 22 | <div class="layout_row_content"><%= f.password_field :password_confirmation %></div> | 22 | <div class="layout_row_content"><%= f.password_field :password_confirmation %></div> |
| 23 | 23 | ||
| 24 | <div class="layout_row_label">Admin?</div> | 24 | <div class="layout_row_label"><%= t("users.labels.admin") %></div> |
| 25 | <div class="layout_row_content"><%= f.check_box :admin %></div> | 25 | <div class="layout_row_content"><%= f.check_box :admin %></div> |
| 26 | 26 | ||
| 27 | <div class="layout_row_label"></div> | 27 | <div class="layout_row_label"></div> |
| 28 | <div class="layout_row_content"><%= f.submit "Create" %></div> | 28 | <div class="layout_row_content"><%= f.submit t("admin.common.create") %></div> |
| 29 | <% end %> | 29 | <% end %> |
| 30 | </div> | 30 | </div> |
| 31 | </div> | 31 | </div> |
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 @@ | |||
| 2 | <h1><%= @user.login %></h1> | 2 | <h1><%= @user.login %></h1> |
| 3 | 3 | ||
| 4 | <div id="content"> | 4 | <div id="content"> |
| 5 | <div class="layout_row_label">Actions</div> | 5 | <div class="layout_row_label"><%= t("admin.columns.actions") %></div> |
| 6 | <div class="layout_row_content info_group"> | 6 | <div class="layout_row_content info_group"> |
| 7 | <div class="info_group_items"> | 7 | <div class="info_group_items"> |
| 8 | <div class="info_item"> | 8 | <div class="info_item"> |
| 9 | <%= link_to edit_user_path(@user), class: 'action_button' do %> | 9 | <%= link_to edit_user_path(@user), class: 'action_button' do %> |
| 10 | <%= icon("edit", library: "tabler", "aria-hidden": true) %> Edit | 10 | <%= icon("edit", library: "tabler", "aria-hidden": true) %> <%= t("admin.common.edit") %> |
| 11 | <% end %> | 11 | <% end %> |
| 12 | </div> | 12 | </div> |
| 13 | </div> | 13 | </div> |
| 14 | </div> | 14 | </div> |
| 15 | 15 | ||
| 16 | <div class="layout_row_label">Login</div> | 16 | <div class="layout_row_label"><%= t("users.labels.login") %></div> |
| 17 | <div class="layout_row_content"><%= @user.login %></div> | 17 | <div class="layout_row_content"><%= @user.login %></div> |
| 18 | 18 | ||
| 19 | <div class="layout_row_label">E-Mail</div> | 19 | <div class="layout_row_label"><%= t("users.labels.email") %></div> |
| 20 | <div class="layout_row_content"><%= @user.email %></div> | 20 | <div class="layout_row_content"><%= @user.email %></div> |
| 21 | 21 | ||
| 22 | <div class="layout_row_label">Admin?</div> | 22 | <div class="layout_row_label"><%= t("users.labels.admin") %></div> |
| 23 | <div class="layout_row_content"><%= @user.admin ? "yes" : "no" %></div> | 23 | <div class="layout_row_content"><%= @user.admin ? t("admin.common.yes") : t("admin.common.no") %></div> |
| 24 | </div> | 24 | </div> |
| 25 | </div> | 25 | </div> |
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: | |||
| 84 | container_aria_label: "Seitennavigation" | 84 | container_aria_label: "Seitennavigation" |
| 85 | page_aria_label: "Seite %{page}" | 85 | page_aria_label: "Seite %{page}" |
| 86 | 86 | ||
| 87 | tags: | ||
| 88 | index: | ||
| 89 | title: "Tags" | ||
| 90 | |||
| 87 | node_actions: | 91 | node_actions: |
| 88 | heading: "Letzte Änderungen" | 92 | heading: "Letzte Änderungen" |
| 89 | show_all: "Alle Einträge zeigen" | 93 | show_all: "Alle Einträge zeigen" |
| @@ -172,11 +176,6 @@ de: | |||
| 172 | edit: | 176 | edit: |
| 173 | my_account: "Mein Konto" | 177 | my_account: "Mein Konto" |
| 174 | edit_user: "Benutzer „%{login}“ bearbeiten" | 178 | edit_user: "Benutzer „%{login}“ bearbeiten" |
| 175 | login: "Anmeldename" | ||
| 176 | email: "E-Mail" | ||
| 177 | password: "Passwort" | ||
| 178 | confirm: "bestätigen" | ||
| 179 | admin: "Admin?" | ||
| 180 | update: "Aktualisieren" | 179 | update: "Aktualisieren" |
| 181 | enabled: "Aktiviert." | 180 | enabled: "Aktiviert." |
| 182 | not_enrolled: "Nicht eingerichtet." | 181 | not_enrolled: "Nicht eingerichtet." |
| @@ -187,6 +186,21 @@ de: | |||
| 187 | disable_second_factor: "Zweiten Faktor entfernen" | 186 | disable_second_factor: "Zweiten Faktor entfernen" |
| 188 | reset_second_factor: "Zweiten Faktor zurücksetzen" | 187 | reset_second_factor: "Zweiten Faktor zurücksetzen" |
| 189 | reset_confirm: "Zweiten Faktor von %{login} zurücksetzen? Die Anmeldung ist danach nur mit Passwort möglich." | 188 | reset_confirm: "Zweiten Faktor von %{login} zurücksetzen? Die Anmeldung ist danach nur mit Passwort möglich." |
| 189 | labels: | ||
| 190 | login: "Anmeldename" | ||
| 191 | email: "E-Mail" | ||
| 192 | password: "Passwort" | ||
| 193 | confirm: "bestätigen" | ||
| 194 | admin: "Admin?" | ||
| 195 | user: | ||
| 196 | confirm_destroy: "Benutzer %{login} wirklich löschen?" | ||
| 197 | index: | ||
| 198 | admins: "Admins" | ||
| 199 | create_admin: "Admin-Benutzer anlegen" | ||
| 200 | users: "Benutzer" | ||
| 201 | create_user: "Benutzer anlegen" | ||
| 202 | new: | ||
| 203 | title: "Neuen Benutzer anlegen" | ||
| 190 | 204 | ||
| 191 | admin: | 205 | admin: |
| 192 | common: | 206 | common: |
| @@ -198,6 +212,8 @@ de: | |||
| 198 | confirm_irreversible: "Das kann nicht rückgängig gemacht werden. Fortfahren?" | 212 | confirm_irreversible: "Das kann nicht rückgängig gemacht werden. Fortfahren?" |
| 199 | toggle_preview: "Live-Vorschau umschalten" | 213 | toggle_preview: "Live-Vorschau umschalten" |
| 200 | force_render: "Vorschau neu rendern" | 214 | force_render: "Vorschau neu rendern" |
| 215 | "yes": "ja" | ||
| 216 | "no": "nein" | ||
| 201 | columns: | 217 | columns: |
| 202 | id: "ID" | 218 | id: "ID" |
| 203 | title: "Titel" | 219 | 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: | |||
| 36 | container_aria_label: "Pagination" | 36 | container_aria_label: "Pagination" |
| 37 | page_aria_label: "Page %{page}" | 37 | page_aria_label: "Page %{page}" |
| 38 | 38 | ||
| 39 | tags: | ||
| 40 | index: | ||
| 41 | title: "Tags" | ||
| 42 | |||
| 39 | node_actions: | 43 | node_actions: |
| 40 | heading: "Action log" | 44 | heading: "Action log" |
| 41 | show_all: "Show all entries" | 45 | show_all: "Show all entries" |
| @@ -124,11 +128,6 @@ en: | |||
| 124 | edit: | 128 | edit: |
| 125 | my_account: "My account" | 129 | my_account: "My account" |
| 126 | edit_user: "Edit user “%{login}”" | 130 | edit_user: "Edit user “%{login}”" |
| 127 | login: "login" | ||
| 128 | email: "e-mail" | ||
| 129 | password: "password" | ||
| 130 | confirm: "confirm" | ||
| 131 | admin: "admin?" | ||
| 132 | update: "Update" | 131 | update: "Update" |
| 133 | enabled: "Enabled." | 132 | enabled: "Enabled." |
| 134 | not_enrolled: "Not enrolled." | 133 | not_enrolled: "Not enrolled." |
| @@ -139,6 +138,21 @@ en: | |||
| 139 | disable_second_factor: "Disable second factor" | 138 | disable_second_factor: "Disable second factor" |
| 140 | reset_second_factor: "Reset second factor" | 139 | reset_second_factor: "Reset second factor" |
| 141 | reset_confirm: "Reset %{login}'s second factor? They will log in with password only afterwards." | 140 | reset_confirm: "Reset %{login}'s second factor? They will log in with password only afterwards." |
| 141 | labels: | ||
| 142 | login: "login" | ||
| 143 | email: "e-mail" | ||
| 144 | password: "password" | ||
| 145 | confirm: "confirm" | ||
| 146 | admin: "admin?" | ||
| 147 | user: | ||
| 148 | confirm_destroy: "Do you really want to destroy user %{login}?" | ||
| 149 | index: | ||
| 150 | admins: "Admins" | ||
| 151 | create_admin: "Create admin user" | ||
| 152 | users: "Users" | ||
| 153 | create_user: "Create user" | ||
| 154 | new: | ||
| 155 | title: "Create new user" | ||
| 142 | 156 | ||
| 143 | admin: | 157 | admin: |
| 144 | common: | 158 | common: |
| @@ -150,6 +164,8 @@ en: | |||
| 150 | confirm_irreversible: "This cannot be undone. Continue?" | 164 | confirm_irreversible: "This cannot be undone. Continue?" |
| 151 | toggle_preview: "Toggle live preview" | 165 | toggle_preview: "Toggle live preview" |
| 152 | force_render: "Force preview render" | 166 | force_render: "Force preview render" |
| 167 | "yes": "yes" | ||
| 168 | "no": "no" | ||
| 153 | columns: | 169 | columns: |
| 154 | id: "ID" | 170 | id: "ID" |
| 155 | title: "Title" | 171 | 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 | |||
| 13 | login_as :aaron | 13 | login_as :aaron |
| 14 | get :index | 14 | get :index |
| 15 | assert_response :success | 15 | assert_response :success |
| 16 | assert_select "button[type=submit]", "Destroy" | 16 | assert_select "button[type=submit]", I18n.t("admin.common.destroy") |
| 17 | assert_select "a", "show" | 17 | assert_select "a", "show" |
| 18 | end | 18 | end |
| 19 | 19 | ||
