From 1e28d2900e93da40ae97d7a3f17dea6293187328 Mon Sep 17 00:00:00 2001 From: Roman Rizzi Date: Wed, 20 Jan 2021 18:08:02 -0300 Subject: [PATCH] UX: Fallback locale warning improvements. (#11775) - Improve warning message. - Only display the warning if the language has a fallback and either "allow_user_locale", or "set_locale_from_accept_language_header" are enabled. --- .../admin/addon/controllers/admin-site-text-index.js | 9 +++++++++ .../admin/addon/templates/site-text-index.hbs | 2 +- config/locales/client.en.yml | 2 +- config/site_settings.yml | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/admin/addon/controllers/admin-site-text-index.js b/app/assets/javascripts/admin/addon/controllers/admin-site-text-index.js index 3c0dc9c3b0a..c164236066e 100644 --- a/app/assets/javascripts/admin/addon/controllers/admin-site-text-index.js +++ b/app/assets/javascripts/admin/addon/controllers/admin-site-text-index.js @@ -42,6 +42,15 @@ export default Controller.extend({ } }, + @discourseComputed("locale") + showFallbackLocaleWarning() { + return ( + (this.siteSettings.allow_user_locale || + this.siteSettings.set_locale_from_accept_language_header) && + this.fallbackLocaleFullName + ); + }, + actions: { edit(siteText) { this.transitionToRoute("adminSiteText.edit", siteText.get("id"), { diff --git a/app/assets/javascripts/admin/addon/templates/site-text-index.hbs b/app/assets/javascripts/admin/addon/templates/site-text-index.hbs index 16e835d2709..1595118769c 100644 --- a/app/assets/javascripts/admin/addon/templates/site-text-index.hbs +++ b/app/assets/javascripts/admin/addon/templates/site-text-index.hbs @@ -39,7 +39,7 @@ {{#conditional-loading-spinner condition=searching}} - {{#if fallbackLocaleFullName}} + {{#if showFallbackLocaleWarning}}
{{d-icon "exclamation-circle"}} {{i18n "admin.site_text.fallback_locale_warning" fallback=fallbackLocaleFullName}} diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 4b9d1a78a4f..d58736184a6 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -4847,7 +4847,7 @@ en: recommended: "We recommend customizing the following text to suit your needs:" show_overriden: "Only show overridden" locale: "Language:" - fallback_locale_warning: "You are editing a variety of %{fallback}. Users who choose %{fallback} as their interface language won't see your changes." + fallback_locale_warning: "You are editing a language based on %{fallback}. Users who choose %{fallback} as their interface language won't see your changes." more_than_50_results: "There are more than 50 results. Please refine your search." settings: # used by theme and site settings diff --git a/config/site_settings.yml b/config/site_settings.yml index fec2ca51949..a64dba360ce 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -118,6 +118,7 @@ basic: default: false set_locale_from_accept_language_header: default: false + client: true validator: "AllowUserLocaleEnabledValidator" support_mixed_text_direction: client: true