Bug 1731353 - Migrate TabModalPrompt strings from DTD to FTL. r=fluent-reviewers,mossop,flod

This migrates the remaining strings from both commonDialog.dtd and
dialogOverlay.dtd into a single new tabprompts.ftl file, as they are
only used by TabModalPrompt.

Differential Revision: https://phabricator.services.mozilla.com/D154423
This commit is contained in:
Eemeli Aro 2022-08-15 11:45:04 +00:00
Родитель a23d23117d
Коммит ad69671da6
6 изменённых файлов: 63 добавлений и 27 удалений

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

@ -0,0 +1,43 @@
# 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.helpers import COPY
def migrate(ctx):
"""Bug 1731353 - Migrate tabprompts strings from DTD to FTL, part {index}"""
ctx.add_transforms(
"toolkit/toolkit/global/tabprompts.ftl",
"toolkit/toolkit/global/tabprompts.ftl",
transforms_from(
"""
tabmodalprompt-username =
.value = { COPY(path1, "editfield0.label") }
tabmodalprompt-password =
.value = { COPY(path1, "editfield1.label") }
""",
path1="toolkit/chrome/global/commonDialog.dtd",
),
)
ctx.add_transforms(
"toolkit/toolkit/global/tabprompts.ftl",
"toolkit/toolkit/global/tabprompts.ftl",
transforms_from(
"""
tabmodalprompt-ok-button =
.label = { COPY(path1, "okButton.label") }
tabmodalprompt-cancel-button =
.label = { COPY(path1, "cancelButton.label") }
""",
path1="toolkit/chrome/global/dialogOverlay.dtd",
),
)

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

@ -16,10 +16,11 @@ var TabModalPrompt = class {
let newPrompt = (this.element = win.document.createElement(
"tabmodalprompt"
));
win.MozXULElement.insertFTLIfNeeded("toolkit/global/tabprompts.ftl");
newPrompt.setAttribute("role", "dialog");
let randomIdSuffix = Math.random()
.toString(32)
.substr(2);
.substring(2);
newPrompt.setAttribute("aria-describedby", `infoBody-${randomIdSuffix}`);
newPrompt.appendChild(
win.MozXULElement.parseXULToFragment(
@ -32,12 +33,12 @@ var TabModalPrompt = class {
</div>
<div class="tabmodalprompt-loginContainer" hidden="hidden">
<xul:label class="tabmodalprompt-loginLabel" value="&editfield0.label;" control="loginTextbox-${randomIdSuffix}"/>
<xul:label class="tabmodalprompt-loginLabel" data-l10n-id="tabmodalprompt-username" control="loginTextbox-${randomIdSuffix}"/>
<input class="tabmodalprompt-loginTextbox" id="loginTextbox-${randomIdSuffix}"/>
</div>
<div class="tabmodalprompt-password1Container" hidden="hidden">
<xul:label class="tabmodalprompt-password1Label" value="&editfield1.label;" control="password1Textbox-${randomIdSuffix}"/>
<xul:label class="tabmodalprompt-password1Label" data-l10n-id="tabmodalprompt-password" control="password1Textbox-${randomIdSuffix}"/>
<input class="tabmodalprompt-password1Textbox" type="password" id="password1Textbox-${randomIdSuffix}"/>
</div>
@ -51,15 +52,11 @@ var TabModalPrompt = class {
<div class="tabmodalprompt-buttonContainer">
<xul:button class="tabmodalprompt-button3" hidden="true"/>
<div class="tabmodalprompt-buttonSpacer"/>
<xul:button class="tabmodalprompt-button0" label="&okButton.label;"/>
<xul:button class="tabmodalprompt-button0" data-l10n-id="tabmodalprompt-ok-button"/>
<xul:button class="tabmodalprompt-button2" hidden="true"/>
<xul:button class="tabmodalprompt-button1" label="&cancelButton.label;"/>
<xul:button class="tabmodalprompt-button1" data-l10n-id="tabmodalprompt-cancel-button"/>
</div>
</div>`,
[
"chrome://global/locale/commonDialog.dtd",
"chrome://global/locale/dialogOverlay.dtd",
]
</div>`
)
);

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

@ -1,6 +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/. -->
<!ENTITY editfield0.label "User Name:">
<!ENTITY editfield1.label "Password:">

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

@ -1,9 +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/. -->
<!-- WARNING!!! This file is obsoleted by the dialog.xml widget -->
<!-- OK Cancel Buttons -->
<!ENTITY okButton.label "OK">
<!ENTITY cancelButton.label "Cancel">

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

@ -0,0 +1,13 @@
# 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/.
tabmodalprompt-username =
.value = User Name:
tabmodalprompt-password =
.value = Password:
tabmodalprompt-ok-button =
.label = OK
tabmodalprompt-cancel-button =
.label = Cancel

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

@ -14,11 +14,9 @@
locale/@AB_CD@/global/autocomplete.properties (%chrome/global/autocomplete.properties)
locale/@AB_CD@/global/appPicker.dtd (%chrome/global/appPicker.dtd)
locale/@AB_CD@/global/browser.properties (%chrome/global/browser.properties)
locale/@AB_CD@/global/commonDialog.dtd (%chrome/global/commonDialog.dtd)
locale/@AB_CD@/global/commonDialogs.properties (%chrome/global/commonDialogs.properties)
locale/@AB_CD@/global/contentAreaCommands.properties (%chrome/global/contentAreaCommands.properties)
locale/@AB_CD@/global/datetimebox.dtd (%chrome/global/datetimebox.dtd)
locale/@AB_CD@/global/dialogOverlay.dtd (%chrome/global/dialogOverlay.dtd)
#ifndef MOZ_FENNEC
locale/@AB_CD@/global/editMenuOverlay.dtd (%chrome/global/editMenuOverlay.dtd)
#endif