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.
This commit is contained in:
Roman Rizzi 2021-01-20 18:08:02 -03:00 committed by GitHub
parent 82d2284ce6
commit 1e28d2900e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 2 deletions

View File

@ -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: { actions: {
edit(siteText) { edit(siteText) {
this.transitionToRoute("adminSiteText.edit", siteText.get("id"), { this.transitionToRoute("adminSiteText.edit", siteText.get("id"), {

View File

@ -39,7 +39,7 @@
</div> </div>
{{#conditional-loading-spinner condition=searching}} {{#conditional-loading-spinner condition=searching}}
{{#if fallbackLocaleFullName}} {{#if showFallbackLocaleWarning}}
<div class="alert alert-info"> <div class="alert alert-info">
{{d-icon "exclamation-circle"}} {{d-icon "exclamation-circle"}}
{{i18n "admin.site_text.fallback_locale_warning" fallback=fallbackLocaleFullName}} {{i18n "admin.site_text.fallback_locale_warning" fallback=fallbackLocaleFullName}}

View File

@ -4847,7 +4847,7 @@ en:
recommended: "We recommend customizing the following text to suit your needs:" recommended: "We recommend customizing the following text to suit your needs:"
show_overriden: "Only show overridden" show_overriden: "Only show overridden"
locale: "Language:" 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." more_than_50_results: "There are more than 50 results. Please refine your search."
settings: # used by theme and site settings settings: # used by theme and site settings

View File

@ -118,6 +118,7 @@ basic:
default: false default: false
set_locale_from_accept_language_header: set_locale_from_accept_language_header:
default: false default: false
client: true
validator: "AllowUserLocaleEnabledValidator" validator: "AllowUserLocaleEnabledValidator"
support_mixed_text_direction: support_mixed_text_direction:
client: true client: true