Bug 1379910 - Add Preference option to change the locale strategy for regional preferences r=fluent-reviewers,jaws,flod

Differential Revision: https://phabricator.services.mozilla.com/D69715

--HG--
extra : moz-landing-system : lando
This commit is contained in:
aarushivij 2020-04-14 18:58:24 +00:00
Родитель d389bb562d
Коммит 5931c2dd07
4 изменённых файлов: 37 добавлений и 1 удалений

Просмотреть файл

@ -757,6 +757,8 @@ pref("browser.download.hide_plugins_without_extensions", true);
pref("browser.backspace_action", 0);
#endif
pref("intl.regional_prefs.use_os_locales", false);
// this will automatically enable inline spellchecking (if it is available) for
// editable elements in HTML
// 0 = spellcheck nothing
@ -1203,6 +1205,7 @@ pref("services.sync.prefs.sync.dom.event.contextmenu.enabled", true);
pref("services.sync.prefs.sync.extensions.update.enabled", true);
pref("services.sync.prefs.sync.extensions.activeThemeID", true);
pref("services.sync.prefs.sync.intl.accept_languages", true);
pref("services.sync.prefs.sync.intl.regional_prefs.use_os_locales", true);
pref("services.sync.prefs.sync.layout.spellcheckDefault", true);
pref("services.sync.prefs.sync.media.autoplay.default", true);
pref("services.sync.prefs.sync.media.eme.enabled", true);

Просмотреть файл

@ -326,6 +326,10 @@
</hbox>
</hbox>
<checkbox id="useSystemLocale" hidden="true"
data-l10n-id="use-system-locale"
preference="intl.regional_prefs.use_os_locales"/>
<hbox id="translationBox" hidden="true">
<hbox align="center" flex="1">
<checkbox id="translate" preference="browser.translation.detectLanguage"

Просмотреть файл

@ -147,6 +147,7 @@ Preferences.addAll([
// Languages
{ id: "browser.translation.detectLanguage", type: "bool" },
{ id: "intl.regional_prefs.use_os_locales", type: "bool" },
// General tab
@ -359,7 +360,7 @@ var gMainPane = {
this.updatePerformanceSettingsBox({ duringChangeEvent: true });
});
this.updatePerformanceSettingsBox({ duringChangeEvent: false });
this.displayUseSystemLocale();
let connectionSettingsLink = document.getElementById(
"connectionSettingsLearnMore"
);
@ -1369,6 +1370,29 @@ var gMainPane = {
gMainPane.hideConfirmLanguageChangeMessageBar();
},
displayUseSystemLocale() {
let appLocale = Services.locale.appLocaleAsBCP47;
let regionalPrefsLocales = Services.locale.regionalPrefsLocales;
if (!regionalPrefsLocales.length) {
return;
}
let systemLocale = regionalPrefsLocales[0];
let localeDisplayname = Services.intl.getLocaleDisplayNames(undefined, [
systemLocale,
]);
if (!localeDisplayname.length) {
return;
}
let localeName = localeDisplayname[0];
if (appLocale.split("-u-")[0] != systemLocale.split("-u-")[0]) {
let checkbox = document.getElementById("useSystemLocale");
document.l10n.setAttributes(checkbox, "use-system-locale", {
localeName,
});
checkbox.hidden = false;
}
},
/**
* Displays the translation exceptions dialog where specific site and language
* translation preferences can be set.

Просмотреть файл

@ -285,6 +285,11 @@ translate-exceptions =
.label = Exceptions…
.accesskey = x
# Variables:
# $localeName (string) - Localized name of the locale to be used.
use-system-locale =
.label = Use your operating system settings for “{ $localeName }” to format dates, times, numbers, and measurements.
check-user-spelling =
.label = Check your spelling as you type
.accesskey = t