From e16ed10e23a078822345452abf656271cac56c32 Mon Sep 17 00:00:00 2001 From: Narcis Beleuzu Date: Fri, 14 Oct 2022 09:49:25 +0300 Subject: [PATCH] Backed out changeset a7e5bcf262cd (bug 1786186) - wrong backout --- mobile/android/chrome/geckoview/config.js | 21 +++--- mobile/android/chrome/geckoview/config.xhtml | 37 ++++++----- .../android/locales/en-US/chrome/config.dtd | 21 ++++++ .../locales/en-US/chrome/config.properties | 9 +++ .../en-US/mobile/android/aboutConfig.ftl | 28 -------- mobile/android/locales/jar.mn | 10 +-- .../bug_1786186_mobile_aboutConfig.py | 66 ------------------- 7 files changed, 69 insertions(+), 123 deletions(-) create mode 100644 mobile/android/locales/en-US/chrome/config.dtd create mode 100644 mobile/android/locales/en-US/chrome/config.properties delete mode 100644 mobile/android/locales/en-US/mobile/android/aboutConfig.ftl delete mode 100644 python/l10n/fluent_migrations/bug_1786186_mobile_aboutConfig.py diff --git a/mobile/android/chrome/geckoview/config.js b/mobile/android/chrome/geckoview/config.js index 3c596022ab35..26b01e209d4d 100644 --- a/mobile/android/chrome/geckoview/config.js +++ b/mobile/android/chrome/geckoview/config.js @@ -12,6 +12,9 @@ const PAGE_SCROLL_TRIGGER = 200; // Triggers additional getPrefsBuffer() on user const FILTER_CHANGE_TRIGGER = 200; // Delay between responses to filterInput changes const INNERHTML_VALUE_DELAY = 100; // Delay before providing prefs innerHTML value +var gStringBundle = Services.strings.createBundle( + "chrome://browser/locale/config.properties" +); var gClipboardHelper = Cc["@mozilla.org/widget/clipboardhelper;1"].getService( Ci.nsIClipboardHelper ); @@ -78,9 +81,8 @@ var NewPrefDialog = { // Called to update positive button to display text ("Create"/"Change), and enabled/disabled status // As new pref name is initially displayed, re-focused, or modifed during user input _updatePositiveButton: function AC_updatePositiveButton(aPrefName) { - document.l10n.setAttributes( - this._positiveButton, - "config-new-pref-create-button" + this._positiveButton.textContent = gStringBundle.GetStringFromName( + "newPref.createButton" ); this._positiveButton.setAttribute("disabled", true); if (aPrefName == "") { @@ -92,9 +94,8 @@ var NewPrefDialog = { return i.name == aPrefName; }); if (item.length) { - document.l10n.setAttributes( - this._positiveButton, - "config-new-pref-change-button" + this._positiveButton.textContent = gStringBundle.GetStringFromName( + "newPref.changeButton" ); } else { this._positiveButton.removeAttribute("disabled"); @@ -646,7 +647,9 @@ Pref.prototype = { resetButton.addEventListener("click", function(event) { AboutConfig.resetDefaultPref(event); }); - resetButton.setAttribute("data-l10n-id", "config-pref-reset-button"); + resetButton.textContent = gStringBundle.GetStringFromName( + "pref.resetButton" + ); prefItemLine.appendChild(resetButton); const toggleButton = document.createElement("div"); @@ -654,7 +657,9 @@ Pref.prototype = { toggleButton.addEventListener("click", function(event) { AboutConfig.toggleBoolPref(event); }); - toggleButton.setAttribute("data-l10n-id", "config-pref-toggle-button"); + toggleButton.textContent = gStringBundle.GetStringFromName( + "pref.toggleButton" + ); prefItemLine.appendChild(toggleButton); const upButton = document.createElement("div"); diff --git a/mobile/android/chrome/geckoview/config.xhtml b/mobile/android/chrome/geckoview/config.xhtml index 96a87a1dea61..2cca8aeba4fb 100644 --- a/mobile/android/chrome/geckoview/config.xhtml +++ b/mobile/android/chrome/geckoview/config.xhtml @@ -4,7 +4,13 @@ - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - + +%globalDTD; + +%configDTD; +]> @@ -13,13 +19,12 @@ about:config - - +
@@ -27,7 +32,7 @@
-
@@ -39,29 +44,29 @@
  • -
    -
    +
    &newPref.toggleButton;
    - - + +
    -
    -
    +
    &newPref.cancelButton;
    +
  • @@ -75,8 +80,8 @@
    - - + + diff --git a/mobile/android/locales/en-US/chrome/config.dtd b/mobile/android/locales/en-US/chrome/config.dtd new file mode 100644 index 000000000000..95502af40e4c --- /dev/null +++ b/mobile/android/locales/en-US/chrome/config.dtd @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + diff --git a/mobile/android/locales/en-US/chrome/config.properties b/mobile/android/locales/en-US/chrome/config.properties new file mode 100644 index 000000000000..61fdf73b3299 --- /dev/null +++ b/mobile/android/locales/en-US/chrome/config.properties @@ -0,0 +1,9 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +newPref.createButton=Create +newPref.changeButton=Change + +pref.toggleButton=Toggle +pref.resetButton=Reset diff --git a/mobile/android/locales/en-US/mobile/android/aboutConfig.ftl b/mobile/android/locales/en-US/mobile/android/aboutConfig.ftl deleted file mode 100644 index 5cb419181a07..000000000000 --- a/mobile/android/locales/en-US/mobile/android/aboutConfig.ftl +++ /dev/null @@ -1,28 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -config-toolbar-search = - .placeholder = Search -config-new-pref-name = - .placeholder = Name - -config-new-pref-value-boolean = Boolean -config-new-pref-value-string = String -config-new-pref-value-integer = Integer - -config-new-pref-string = - .placeholder = Enter a string -config-new-pref-number = - .placeholder = Enter a number -config-new-pref-cancel-button = Cancel -config-new-pref-create-button = Create -config-new-pref-change-button = Change - -config-pref-toggle-button = Toggle -config-pref-reset-button = Reset - -config-context-menu-copy-pref-name = - .label = Copy Name -config-context-menu-copy-pref-value = - .label = Copy Value diff --git a/mobile/android/locales/jar.mn b/mobile/android/locales/jar.mn index 6b260ff64e93..28c586d27c3f 100644 --- a/mobile/android/locales/jar.mn +++ b/mobile/android/locales/jar.mn @@ -10,6 +10,8 @@ @AB_CD@.jar: % locale browser @AB_CD@ %locale/@AB_CD@/browser/ locale/@AB_CD@/browser/browser.properties (%chrome/browser.properties) + locale/@AB_CD@/browser/config.dtd (%chrome/config.dtd) + locale/@AB_CD@/browser/config.properties (%chrome/config.properties) locale/@AB_CD@/browser/passwordmgr.properties (%chrome/passwordmgr.properties) # overrides for toolkit l10n, also for en-US @@ -27,17 +29,15 @@ relativesrcdir dom/locales: # Fluent files # Note: All rules must be wildcards, as localized files are optional +# Only run this if we're not en-US, as en-US is already built +# by toolkit/locales/jar.mn. # If you're including files from a subdirectory, ensure that you're # putting them into the corresponding subdirectory in the target. # The wildcard ** does that for us in toolkit. -[localization] @AB_CD@.jar: - mobile/android (%mobile/android/**/*.ftl) - -# Only run this if we're not en-US, as en-US is already built -# by toolkit/locales/jar.mn. #define EN_US en-US #if AB_CD != EN_US +[localization] @AB_CD@.jar: relativesrcdir toolkit/locales: #about:crashes crashreporter (%crashreporter/**/*.ftl) diff --git a/python/l10n/fluent_migrations/bug_1786186_mobile_aboutConfig.py b/python/l10n/fluent_migrations/bug_1786186_mobile_aboutConfig.py deleted file mode 100644 index ef42a2618cbf..000000000000 --- a/python/l10n/fluent_migrations/bug_1786186_mobile_aboutConfig.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf8 - -# Any copyright is dedicated to the Public Domain. -# http://creativecommons.org/publicdomain/zero/1.0/ - -from __future__ import absolute_import -import fluent.syntax.ast as FTL -from fluent.migrate.helpers import transforms_from -from fluent.migrate.transforms import COPY - - -def migrate(ctx): - """Bug 1786186 - Migrate mobile about:config to Fluent, part {index}""" - - target = "mobile/android/mobile/android/aboutConfig.ftl" - - ctx.add_transforms( - target, - target, - transforms_from( - """ - -config-toolbar-search = - .placeholder = { COPY(path1, "toolbar.searchPlaceholder") } -config-new-pref-name = - .placeholder = { COPY(path1, "newPref.namePlaceholder") } -config-new-pref-value-boolean = { COPY(path1, "newPref.valueBoolean") } -config-new-pref-value-string = { COPY(path1, "newPref.valueString") } -config-new-pref-value-integer = { COPY(path1, "newPref.valueInteger") } -config-new-pref-string = - .placeholder = { COPY(path1, "newPref.stringPlaceholder") } -config-new-pref-number = - .placeholder = { COPY(path1, "newPref.numberPlaceholder") } -config-new-pref-cancel-button = { COPY(path1, "newPref.cancelButton") } -config-context-menu-copy-pref-name = - .label = { COPY(path1, "contextMenu.copyPrefName") } -config-context-menu-copy-pref-value = - .label = { COPY(path1, "contextMenu.copyPrefValue") } -""", - path1="mobile/android/chrome/config.dtd", - ), - ) - - source = "mobile/android/chrome/config.properties" - ctx.add_transforms( - target, - target, - [ - FTL.Message( - id=FTL.Identifier("config-new-pref-create-button"), - value=COPY(source, "newPref.createButton"), - ), - FTL.Message( - id=FTL.Identifier("config-new-pref-change-button"), - value=COPY(source, "newPref.changeButton"), - ), - FTL.Message( - id=FTL.Identifier("config-pref-toggle-button"), - value=COPY(source, "pref.toggleButton"), - ), - FTL.Message( - id=FTL.Identifier("config-pref-reset-button"), - value=COPY(source, "pref.resetButton"), - ), - ], - )