From c235e9b9199ed5c65ae12a1c5def48e49e0db554 Mon Sep 17 00:00:00 2001 From: 0ko <0ko@noreply.codeberg.org> Date: Sat, 20 Jul 2024 16:38:59 +0000 Subject: [PATCH] ui: encourage participation in the localization of Forgejo in language settings (#4596) Changes: - clarify how the language selector works as this is not very unclear: the footer selector is per-session and the settings selector is per-account, usually users need the 2nd - tell about how to participate in improvement of localization via this link: https://forgejo.org/docs/latest/developer/localization/. Test that the link is present by extending and existing test Preview: - https://codeberg.org/attachments/f5d04fa1-2e9a-46e4-ac94-d8effefb9762 - https://codeberg.org/attachments/2a820bf5-1326-4c4a-9aff-4b9b70ee1bc0 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4596 Reviewed-by: Gusted Reviewed-by: Earl Warren --- options/locale/locale_en-US.ini | 2 ++ templates/user/settings/appearance.tmpl | 6 ++++++ tests/integration/user_test.go | 3 +++ 3 files changed, 11 insertions(+) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index e528c62dcd..042324bedc 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -741,6 +741,8 @@ continue = Continue cancel = Cancel language = Language language.title = Default language +language.description = This language will be saved to your account and be used as the default after you log in. +language.localization_project = Help us translate Forgejo into your language! Learn more. ui = Theme hints = Hints additional_repo_units_hint = Suggest to enable additional repository units diff --git a/templates/user/settings/appearance.tmpl b/templates/user/settings/appearance.tmpl index c1d7ac2ccc..3e60b5cbcd 100644 --- a/templates/user/settings/appearance.tmpl +++ b/templates/user/settings/appearance.tmpl @@ -47,6 +47,9 @@
+
+ {{ctx.Locale.Tr "settings.language.description"}} +
{{.CsrfTokenHtml}}
+
+ {{ctx.Locale.Tr "settings.language.localization_project" "https://forgejo.org/docs/latest/developer/localization/"}} +
diff --git a/tests/integration/user_test.go b/tests/integration/user_test.go index d875c2f8ff..ae6d6a48c0 100644 --- a/tests/integration/user_test.go +++ b/tests/integration/user_test.go @@ -380,6 +380,9 @@ func TestUserHints(t *testing.T) { _, hintChecked := htmlDoc.Find(`input[name="enable_repo_unit_hints"]`).Attr("checked") assert.Equal(t, enabled, hintChecked) + + link, _ := htmlDoc.Find("form[action='/user/settings/appearance/language'] a").Attr("href") + assert.EqualValues(t, "https://forgejo.org/docs/latest/developer/localization/", link) } t.Run("view", func(t *testing.T) {