Backed out changeset a7e5bcf262cd (bug 1786186) - wrong backout

This commit is contained in:
Narcis Beleuzu 2022-10-14 09:49:25 +03:00
parent 1d7d01e03d
commit e16ed10e23
7 changed files with 69 additions and 123 deletions

View File

@ -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");

View File

@ -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/. -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" [
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd" >
%globalDTD;
<!ENTITY % configDTD SYSTEM "chrome://browser/locale/config.dtd">
%configDTD;
]>
<html xmlns="http://www.w3.org/1999/xhtml">
@ -13,13 +19,12 @@
<title>about:config</title>
<meta charset="UTF-8" />
<link rel="localization" href="mobile/android/aboutConfig.ftl"/>
<link rel="stylesheet" href="chrome://geckoview/skin/config.css" type="text/css"/>
<script type="text/javascript" src="chrome://geckoview/content/config.js"></script>
</head>
<body onload="NewPrefDialog.init(); AboutConfig.init();"
onunload="AboutConfig.uninit();">
<body dir="&locale.dir;" onload="NewPrefDialog.init(); AboutConfig.init();"
onunload="AboutConfig.uninit();">
<div class="toolbar">
<div class="toolbar-container">
@ -27,7 +32,7 @@
<div class="toolbar-item" id="filter-container">
<div id="filter-search-button"/>
<input id="filter-input" type="search" data-l10n-id="config-toolbar-search" value=""
<input id="filter-input" type="search" placeholder="&toolbar.searchPlaceholder;" value=""
oninput="AboutConfig.bufferFilterInput();"/>
<div id="filter-input-clear-button" onclick="AboutConfig.clearFilterInput();"/>
</div>
@ -39,29 +44,29 @@
<div id="new-pref-container">
<li class="pref-item" id="new-pref-item">
<div class="pref-item-line">
<input class="pref-name" id="new-pref-name" type="text" data-l10n-id="config-new-pref-name"
<input class="pref-name" id="new-pref-name" type="text" placeholder="&newPref.namePlaceholder;"
onfocus="NewPrefDialog.focusName(event);"
oninput="NewPrefDialog.updateName(event);"/>
<select id="new-pref-type" onchange="NewPrefDialog.type = event.target.value;">
<option value="boolean" data-l10n-id="config-new-pref-value-boolean"></option>
<option value="string" data-l10n-id="config-new-pref-value-string"></option>
<option value="int" data-l10n-id="config-new-pref-value-integer"></option>
<option value="boolean">&newPref.valueBoolean;</option>
<option value="string">&newPref.valueString;</option>
<option value="int">&newPref.valueInteger;</option>
</select>
</div>
<div class="pref-item-line" id="new-pref-line-boolean">
<input class="pref-value" id="new-pref-value-boolean" disabled="disabled"/>
<div class="pref-button toggle" onclick="NewPrefDialog.toggleBoolValue();" data-l10n-id="config-pref-toggle-button"></div>
<div class="pref-button toggle" onclick="NewPrefDialog.toggleBoolValue();">&newPref.toggleButton;</div>
</div>
<div class="pref-item-line" id="new-pref-line-input">
<input class="pref-value" id="new-pref-value-string" data-l10n-id="config-new-pref-string"/>
<input class="pref-value" id="new-pref-value-int" data-l10n-id="config-new-pref-number" type="number"/>
<input class="pref-value" id="new-pref-value-string" placeholder="&newPref.stringPlaceholder;"/>
<input class="pref-value" id="new-pref-value-int" placeholder="&newPref.numberPlaceholder;" type="number"/>
</div>
<div class="pref-item-line">
<div class="pref-button cancel" id="negative-button" onclick="NewPrefDialog.hide();" data-l10n-id="config-new-pref-cancel-button"></div>
<div class="pref-button create" id="positive-button" onclick="NewPrefDialog.create(event);" data-l10n-id="config-new-pref-create-button"></div>
<div class="pref-button cancel" id="negative-button" onclick="NewPrefDialog.hide();">&newPref.cancelButton;</div>
<div class="pref-button create" id="positive-button" onclick="NewPrefDialog.create(event);"></div>
</div>
</li>
</div>
@ -75,8 +80,8 @@
</div>
<menu type="context" id="prefs-context-menu">
<menuitem data-l10n-id="config-context-menu-copy-pref-name" onclick="AboutConfig.clipboardCopy('name');"></menuitem>
<menuitem data-l10n-id="config-context-menu-copy-pref-value" onclick="AboutConfig.clipboardCopy('value');"></menuitem>
<menuitem label="&contextMenu.copyPrefName;" onclick="AboutConfig.clipboardCopy('name');"></menuitem>
<menuitem label="&contextMenu.copyPrefValue;" onclick="AboutConfig.clipboardCopy('value');"></menuitem>
</menu>
</body>

View File

@ -0,0 +1,21 @@
<!-- 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/. -->
<!ENTITY toolbar.searchPlaceholder "Search">
<!ENTITY newPref.namePlaceholder "Name">
<!ENTITY newPref.valueBoolean "Boolean">
<!ENTITY newPref.valueString "String">
<!ENTITY newPref.valueInteger "Integer">
<!ENTITY newPref.stringPlaceholder "Enter a string">
<!ENTITY newPref.numberPlaceholder "Enter a number">
<!ENTITY newPref.toggleButton "Toggle">
<!ENTITY newPref.cancelButton "Cancel">
<!ENTITY contextMenu.copyPrefName "Copy Name">
<!ENTITY contextMenu.copyPrefValue "Copy Value">

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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"),
),
],
)