Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

fix(i18n): localize admin SSO headings (#3316)

Thomas Steibl7ffe877531d4
diff --git a/app/views/admin/sso_providers/edit.html.erb b/app/views/admin/sso_providers/edit.html.erb
index 95b3689f11..8339115784 100644
--- a/app/views/admin/sso_providers/edit.html.erb
+++ b/app/views/admin/sso_providers/edit.html.erb
@@ -1,7 +1,7 @@
-<%= content_for :page_title, "Edit #{@sso_provider.label}" %>
+<%= content_for :page_title, t(".title") %>
<div class="space-y-4">
- <p class="text-secondary">Update configuration for <%= @sso_provider.label %>.</p>
+ <p class="text-secondary"><%= t(".description", label: @sso_provider.label) %></p>
<%= settings_section title: t(".provider_configuration") do %>
<%= render "form", sso_provider: @sso_provider %>
diff --git a/app/views/admin/sso_providers/new.html.erb b/app/views/admin/sso_providers/new.html.erb
index a6ff358ff3..e359afa288 100644
--- a/app/views/admin/sso_providers/new.html.erb
+++ b/app/views/admin/sso_providers/new.html.erb
@@ -1,7 +1,7 @@
-<%= content_for :page_title, "Add SSO Provider" %>
+<%= content_for :page_title, t(".title") %>
<div class="space-y-4">
- <p class="text-secondary">Configure a new single sign-on authentication provider.</p>
+ <p class="text-secondary"><%= t(".description") %></p>
<%= settings_section title: t(".provider_configuration") do %>
<%= render "form", sso_provider: @sso_provider %>
diff --git a/test/controllers/admin/sso_providers_controller_test.rb b/test/controllers/admin/sso_providers_controller_test.rb
index c9085055c4..5dc95f09ec 100644
--- a/test/controllers/admin/sso_providers_controller_test.rb
+++ b/test/controllers/admin/sso_providers_controller_test.rb
@@ -27,6 +27,22 @@ class Admin::SsoProvidersControllerTest < ActionDispatch::IntegrationTest
assert_no_match(/name="sso_provider\[client_secret\]"[^>]*required/, response.body)
end
+ test "new page localizes its heading and description" do
+ get new_admin_sso_provider_path(locale: "de")
+
+ assert_response :success
+ assert_select "h1", text: I18n.t("admin.sso_providers.new.title", locale: :de, fallback: false)
+ assert_select "p", text: I18n.t("admin.sso_providers.new.description", locale: :de, fallback: false)
+ end
+
+ test "edit page localizes its heading and description" do
+ get edit_admin_sso_provider_path(@provider, locale: "de")
+
+ assert_response :success
+ assert_select "h1", text: I18n.t("admin.sso_providers.edit.title", locale: :de, fallback: false)
+ assert_select "p", text: I18n.t("admin.sso_providers.edit.description", locale: :de, fallback: false, label: @provider.label)
+ end
+
test "update persists nested default role setting" do
patch admin_sso_provider_path(@provider), params: {
sso_provider: valid_update_params(settings: { default_role: "guest" })