Bug 1524372 - Localize the preference type in the new "about:config" page. r=flod
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Mon, 04 Feb 2019 15:13:14 +0000
changeset 456650 f87b390877dd3d18d20c6b45f5b1825e1923ebba
parent 456649 9fb802aba6b9167ce4ecc0bd3a30704aeb3fb7ae
child 456651 10f6c4319f6c7f6fd8820091ca56a603d524425e
push id35499
push userccoroiu@mozilla.com
push dateMon, 04 Feb 2019 21:42:59 +0000
treeherdermozilla-central@a27965fa7374 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflod
bugs1524372
milestone67.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 1524372 - Localize the preference type in the new "about:config" page. r=flod Differential Revision: https://phabricator.services.mozilla.com/D18509
browser/components/aboutconfig/content/aboutconfig.js
browser/locales/en-US/browser/aboutConfig.ftl
--- a/browser/components/aboutconfig/content/aboutconfig.js
+++ b/browser/components/aboutconfig/content/aboutconfig.js
@@ -9,16 +9,22 @@ const {Preferences} = ChromeUtils.import
 const SEARCH_TIMEOUT_MS = 500;
 
 const GETTERS_BY_PREF_TYPE = {
   [Ci.nsIPrefBranch.PREF_BOOL]: "getBoolPref",
   [Ci.nsIPrefBranch.PREF_INT]: "getIntPref",
   [Ci.nsIPrefBranch.PREF_STRING]: "getStringPref",
 };
 
+const STRINGS_ADD_BY_TYPE = {
+  Boolean: "about-config-pref-add-type-boolean",
+  Number: "about-config-pref-add-type-number",
+  String: "about-config-pref-add-type-string",
+};
+
 let gDefaultBranch = Services.prefs.getDefaultBranch("");
 let gFilterPrefsTask = new DeferredTask(() => filterPrefs(), SEARCH_TIMEOUT_MS);
 
 /**
  * Maps the name of each preference in the back-end to its PrefRow object,
  * separating the preferences that actually exist. This is as an optimization to
  * avoid querying the preferences service each time the list is filtered.
  */
@@ -202,17 +208,17 @@ class PrefRow {
         for (let type of ["Boolean", "Number", "String"]) {
           let radio = document.createElement("input");
           radio.type = "radio";
           radio.name = "type";
           radio.value = type;
           radio.checked = this.type == type;
           form.appendChild(radio);
           let radioLabel = document.createElement("span");
-          radioLabel.textContent = type;
+          document.l10n.setAttributes(radioLabel, STRINGS_ADD_BY_TYPE[type]);
           form.appendChild(radioLabel);
         }
         form.addEventListener("click", event => {
           if (event.target.name != "type") {
             return;
           }
           let type = event.target.value;
           if (this.type != type) {
--- a/browser/locales/en-US/browser/aboutConfig.ftl
+++ b/browser/locales/en-US/browser/aboutConfig.ftl
@@ -15,16 +15,21 @@ about-config-search =
 
 about-config-pref-add = Add
 about-config-pref-toggle = Toggle
 about-config-pref-edit = Edit
 about-config-pref-save = Save
 about-config-pref-reset = Reset
 about-config-pref-delete = Delete
 
+## Labels for the type selection radio buttons shown when adding preferences.
+about-config-pref-add-type-boolean = Boolean
+about-config-pref-add-type-number = Number
+about-config-pref-add-type-string = String
+
 ## Preferences with a non-default value are differentiated visually, and at the
 ## same time the state is made accessible to screen readers using an aria-label
 ## that won't be visible or copied to the clipboard.
 ##
 ## Variables:
 ##   $value (String): The full value of the preference.
 about-config-pref-accessible-value-default =
     .aria-label = { $value } (default)