Bug 1379910 - Add Preference option to change the locale strategy for regional preferences r=fluent-reviewers,jaws,flod
☠☠ backed out by c21c8e619047 ☠ ☠
authoraarushivij <aarushivij@gmail.com>
Tue, 21 Apr 2020 19:17:04 +0000
changeset 588762 d7e299be215a40cc88a0d734d6254dffae53fb3c
parent 588761 b7a400987981a46df5381200e6cb675d702b3c21
child 588763 76a6d3885038eda4b70ef7fbfc18def07ea115ca
push id13072
push userffxbld-merge
push dateMon, 04 May 2020 14:22:08 +0000
treeherdermozilla-beta@8a4f45b9a244 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfluent-reviewers, jaws, flod
bugs1379910
milestone77.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
browser/app/profile/firefox.js
browser/components/preferences/in-content/main.inc.xhtml
browser/components/preferences/in-content/main.js
browser/locales/en-US/browser/preferences/preferences.ftl
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -747,16 +747,18 @@ pref("browser.download.hide_plugins_with
 // 1 act like PgUp/PgDown
 // 2 and other values, nothing
 #ifdef UNIX_BUT_NOT_MAC
   pref("browser.backspace_action", 2);
 #else
   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
 // 1 = check multi-line controls [default]
 // 2 = check multi/single line controls
 pref("layout.spellcheckDefault", 1);
 
 pref("browser.send_pings", false);
@@ -1193,16 +1195,17 @@ pref("services.sync.prefs.sync.browser.u
 pref("services.sync.prefs.sync.browser.urlbar.suggest.searches", true);
 pref("services.sync.prefs.sync.dom.disable_open_during_load", true);
 pref("services.sync.prefs.sync.dom.disable_window_flip", true);
 pref("services.sync.prefs.sync.dom.disable_window_move_resize", true);
 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);
 pref("services.sync.prefs.sync.network.cookie.cookieBehavior", true);
 pref("services.sync.prefs.sync.network.cookie.lifetimePolicy", true);
 pref("services.sync.prefs.sync.network.cookie.thirdparty.sessionOnly", true);
 pref("services.sync.prefs.sync.permissions.default.image", true);
 pref("services.sync.prefs.sync.pref.downloads.disable_button.edit_actions", true);
--- a/browser/components/preferences/in-content/main.inc.xhtml
+++ b/browser/components/preferences/in-content/main.inc.xhtml
@@ -321,16 +321,21 @@
                 languages-customize-movedown.label,
                 languages-customize-remove.label,
                 languages-customize-select-language.placeholder,
                 languages-customize-add.label,
               " />
     </hbox>
   </hbox>
 
+  <checkbox id="useSystemLocale" hidden="true" 
+            data-l10n-id="use-system-locale" 
+            data-l10n-args='{"localeName": "und"}'
+            preference="intl.regional_prefs.use_os_locales"/>
+
   <hbox id="translationBox" hidden="true">
     <hbox align="center" flex="1">
       <checkbox id="translate" preference="browser.translation.detectLanguage"
                 data-l10n-id="translate-web-pages"/>
       <hbox id="bingAttribution" hidden="true" align="center">
         <label data-l10n-id="translate-attribution">
           <html:img id="translationAttributionImage" aria-label="Microsoft Translator"
             src="chrome://browser/content/microsoft-translator-attribution.png"
--- a/browser/components/preferences/in-content/main.js
+++ b/browser/components/preferences/in-content/main.js
@@ -142,16 +142,17 @@ Preferences.addAll([
     type: "bool",
   },
 
   // Fonts
   { id: "font.language.group", type: "wstring" },
 
   // Languages
   { id: "browser.translation.detectLanguage", type: "bool" },
+  { id: "intl.regional_prefs.use_os_locales", type: "bool" },
 
   // General tab
 
   /* Accessibility
    * accessibility.browsewithcaret
      - true enables keyboard navigation and selection within web pages using a
        visible caret, false uses normal keyboard navigation with no caret
    * accessibility.typeaheadfind
@@ -354,17 +355,17 @@ var gMainPane = {
 
     let defaultPerformancePref = Preferences.get(
       "browser.preferences.defaultPerformanceSettings.enabled"
     );
     defaultPerformancePref.on("change", () => {
       this.updatePerformanceSettingsBox({ duringChangeEvent: true });
     });
     this.updatePerformanceSettingsBox({ duringChangeEvent: false });
-
+    this.displayUseSystemLocale();
     let connectionSettingsLink = document.getElementById(
       "connectionSettingsLearnMore"
     );
     let connectionSettingsUrl =
       Services.urlFormatter.formatURLPref("app.support.baseURL") +
       "prefs-connection-settings";
     connectionSettingsLink.setAttribute("href", connectionSettingsUrl);
     this.updateProxySettingsUI();
@@ -1364,16 +1365,39 @@ var gMainPane = {
       return;
     }
 
     // They matched, so we can reset the UI.
     gMainPane.setBrowserLocales(Services.locale.appLocaleAsBCP47);
     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.
    */
   showTranslationExceptions() {
     gSubDialog.open("chrome://browser/content/preferences/translation.xhtml");
   },
 
--- a/browser/locales/en-US/browser/preferences/preferences.ftl
+++ b/browser/locales/en-US/browser/preferences/preferences.ftl
@@ -280,16 +280,21 @@ translate-web-pages =
 # The <img> element is replaced by the logo of the provider
 # used to provide machine translations for web pages.
 translate-attribution = Translations by <img data-l10n-name="logo"/>
 
 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
 
 ## General Section - Files and Applications
 
 files-and-applications-title = Files and Applications