зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1785216 - Migrate notification.dtd to Fluent. r=jaws,fluent-reviewers,flod,mconley
Except for the close-notification-message, all of the notification.dtd strings are only used by popupnotification.js. Accordingly, the strings are migrated to two different FTL files. Differential Revision: https://phabricator.services.mozilla.com/D154890
This commit is contained in:
Родитель
3312ce0c28
Коммит
4ce19437ce
|
@ -284,6 +284,10 @@ var whitelist = [
|
|||
// References to esm generated from jsm programatically
|
||||
{ file: "resource://gre/modules/LangPackMatcher.sys.mjs" },
|
||||
{ file: "resource://gre/modules/PluralForm.sys.mjs" },
|
||||
|
||||
// Bug 1788595 - used by Firefox Translations extension
|
||||
// see also https://github.com/mozilla/firefox-translations/issues/496
|
||||
{ file: "chrome://global/locale/notification.dtd" },
|
||||
];
|
||||
|
||||
if (AppConstants.NIGHTLY_BUILD && AppConstants.platform != "win") {
|
||||
|
|
|
@ -77,19 +77,17 @@ class MozTranslationNotification extends MozElements.Notification {
|
|||
</hbox>
|
||||
<toolbarbutton anonid="closeButton" ondblclick="event.stopPropagation();"
|
||||
class="messageCloseButton close-icon tabbable"
|
||||
tooltiptext="&closeNotification.tooltip;"
|
||||
data-l10n-id="close-notification-message"
|
||||
oncommand="this.parentNode.closeCommand();"/>
|
||||
`;
|
||||
}
|
||||
|
||||
static get entities() {
|
||||
return [
|
||||
"chrome://global/locale/notification.dtd",
|
||||
"chrome://browser/locale/translation.dtd",
|
||||
];
|
||||
return ["chrome://browser/locale/translation.dtd"];
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
MozXULElement.insertFTLIfNeeded("toolkit/global/notification.ftl");
|
||||
this.appendChild(this.constructor.fragment);
|
||||
|
||||
for (let [propertyName, selector] of [
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
# 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 1785216 - Migrate notification.dtd to Fluent, part {index}"""
|
||||
|
||||
source = "toolkit/chrome/global/notification.dtd"
|
||||
ctx.add_transforms(
|
||||
"toolkit/toolkit/global/notification.ftl",
|
||||
"toolkit/toolkit/global/notification.ftl",
|
||||
transforms_from(
|
||||
"""
|
||||
|
||||
close-notification-message =
|
||||
.tooltiptext = { COPY(path1, "closeNotification.tooltip") }
|
||||
""",
|
||||
path1=source,
|
||||
),
|
||||
)
|
||||
|
||||
ctx.add_transforms(
|
||||
"toolkit/toolkit/global/popupnotification.ftl",
|
||||
"toolkit/toolkit/global/popupnotification.ftl",
|
||||
transforms_from(
|
||||
"""
|
||||
|
||||
popup-notification-learn-more = { COPY(path1, "learnMoreNoEllipsis") }
|
||||
popup-notification-more-actions-button =
|
||||
.aria-label = { COPY(path1, "moreActionsButton.accessibleLabel") }
|
||||
popup-notification-default-button =
|
||||
.label = { COPY(path1, "defaultButton.label") }
|
||||
.accesskey = { COPY(path1, "defaultButton.accesskey") }
|
||||
""",
|
||||
path1=source,
|
||||
),
|
||||
)
|
|
@ -480,11 +480,6 @@
|
|||
* return `<hbox class="example"`;
|
||||
* }
|
||||
*
|
||||
* static get entities() {
|
||||
* // Optional field for parseXULToFragment
|
||||
* return `["chrome://global/locale/notification.dtd"]`;
|
||||
* }
|
||||
*
|
||||
* connectedCallback() {
|
||||
* this.appendChild(this.constructor.fragment);
|
||||
* }
|
||||
|
|
|
@ -414,15 +414,11 @@
|
|||
</hbox>
|
||||
<toolbarbutton ondblclick="event.stopPropagation();"
|
||||
class="messageCloseButton close-icon tabbable"
|
||||
tooltiptext="&closeNotification.tooltip;"
|
||||
data-l10n-id="close-notification-message"
|
||||
oncommand="this.parentNode.dismiss();"/>
|
||||
`;
|
||||
}
|
||||
|
||||
static get entities() {
|
||||
return ["chrome://global/locale/notification.dtd"];
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.persistence = 0;
|
||||
|
@ -433,6 +429,7 @@
|
|||
}
|
||||
|
||||
connectedCallback() {
|
||||
MozXULElement.insertFTLIfNeeded("toolkit/global/notification.ftl");
|
||||
this.appendChild(this.constructor.fragment);
|
||||
|
||||
for (let [propertyName, selector] of [
|
||||
|
|
|
@ -44,6 +44,13 @@
|
|||
return;
|
||||
}
|
||||
|
||||
// If the label and/or accesskey for the primary button is set by
|
||||
// inherited attributes, its data-l10n-id needs to be unset or
|
||||
// DOM Localization will overwrite the values.
|
||||
if (name === "buttonlabel" || name === "buttonaccesskey") {
|
||||
document.l10n.setAttributes(this.button, "");
|
||||
}
|
||||
|
||||
super.attributeChangedCallback(name, oldValue, newValue);
|
||||
}
|
||||
|
||||
|
@ -78,10 +85,10 @@
|
|||
<description class="popup-notification-description"><html:span></html:span><html:b></html:b><html:span></html:span><html:b></html:b><html:span></html:span></description>
|
||||
<description class="popup-notification-hint-text"></description>
|
||||
</vbox>
|
||||
<toolbarbutton class="messageCloseButton close-icon popup-notification-closebutton tabbable" tooltiptext="&closeNotification.tooltip;"></toolbarbutton>
|
||||
<toolbarbutton class="messageCloseButton close-icon popup-notification-closebutton tabbable" data-l10n-id="close-notification-message"></toolbarbutton>
|
||||
</hbox>
|
||||
<vbox class="popup-notification-bottom-content" align="start">
|
||||
<label class="popup-notification-learnmore-link" is="text-link">&learnMoreNoEllipsis;</label>
|
||||
<label class="popup-notification-learnmore-link" is="text-link" data-l10n-id="popup-notification-learn-more"></label>
|
||||
<checkbox class="popup-notification-checkbox" oncommand="PopupNotifications._onCheckboxCommand(event)"/>
|
||||
<description class="popup-notification-warning"/>
|
||||
</vbox>
|
||||
|
@ -90,27 +97,31 @@
|
|||
<hbox class="popup-notification-footer-container"></hbox>
|
||||
<hbox class="popup-notification-button-container panel-footer">
|
||||
<button class="popup-notification-secondary-button"/>
|
||||
<button type="menu" class="popup-notification-dropmarker" aria-label="&moreActionsButton.accessibleLabel;">
|
||||
<menupopup position="after_end" aria-label="&moreActionsButton.accessibleLabel;">
|
||||
<button type="menu" class="popup-notification-dropmarker" data-l10n-id="popup-notification-more-actions-button">
|
||||
<menupopup position="after_end" data-l10n-id="popup-notification-more-actions-button">
|
||||
</menupopup>
|
||||
</button>
|
||||
<button class="popup-notification-primary-button" label="&defaultButton.label;" accesskey="&defaultButton.accesskey;"/>
|
||||
<button class="popup-notification-primary-button" data-l10n-id="popup-notification-default-button"/>
|
||||
</hbox>
|
||||
`;
|
||||
}
|
||||
|
||||
static get entities() {
|
||||
return ["chrome://global/locale/notification.dtd"];
|
||||
}
|
||||
|
||||
slotContents() {
|
||||
if (this._hasSlotted) {
|
||||
return;
|
||||
}
|
||||
this._hasSlotted = true;
|
||||
MozXULElement.insertFTLIfNeeded("toolkit/global/notification.ftl");
|
||||
MozXULElement.insertFTLIfNeeded("toolkit/global/popupnotification.ftl");
|
||||
this.appendChild(this.constructor.fragment);
|
||||
|
||||
this.button = this.querySelector(".popup-notification-primary-button");
|
||||
if (
|
||||
this.hasAttribute("buttonlabel") ||
|
||||
this.hasAttribute("buttonaccesskey")
|
||||
) {
|
||||
this.button.removeAttribute("data-l10n-id");
|
||||
}
|
||||
this.secondaryButton = this.querySelector(
|
||||
".popup-notification-secondary-button"
|
||||
);
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
- 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/. -->
|
||||
|
||||
<!-- This file is only used by the Firefox Translations extension,
|
||||
- and should be removed once possible.
|
||||
- See: https://bugzilla.mozilla.org/show_bug.cgi?id=1788595 -->
|
||||
|
||||
<!ENTITY closeNotification.tooltip "Close this message">
|
||||
|
||||
<!ENTITY learnMoreNoEllipsis "Learn more">
|
||||
|
|
|
@ -9,3 +9,6 @@ notification-learnmore-default-label =
|
|||
# "infobar" (message shown when for example a popup is blocked).
|
||||
close-button-label =
|
||||
.aria-label = Close
|
||||
|
||||
close-notification-message =
|
||||
.tooltiptext = Close this message
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
# 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/.
|
||||
|
||||
popup-notification-learn-more = Learn more
|
||||
popup-notification-more-actions-button =
|
||||
.aria-label = More actions
|
||||
popup-notification-default-button =
|
||||
.label = OK!
|
||||
.accesskey = O
|
Загрузка…
Ссылка в новой задаче