Backed out 3 changesets (bug 1760033) for causing multiple failures ErrorResult.h

Backed out changeset e54df449fbad (bug 1760033)
Backed out changeset f26056c61dc2 (bug 1760033)
Backed out changeset 7f69b83013e1 (bug 1760033)
This commit is contained in:
Norisz Fay 2022-10-12 17:28:18 +03:00
parent 15fb28ef11
commit 474baf5b68
18 changed files with 249 additions and 410 deletions

View File

@ -19,6 +19,10 @@ ChromeUtils.defineModuleGetter(
"chrome://pocket/content/pktApi.jsm"
);
const gStringBundle = Services.strings.createBundle(
"chrome://global/locale/aboutReader.properties"
);
// A set of all of the AboutReaderParent actors that exist.
// See bug 1631146 for a request for a less manual way of doing this.
let gAllActors = new Set();
@ -220,30 +224,43 @@ export class AboutReaderParent extends JSWindowActorParent {
return;
}
let doc = browser.ownerGlobal.document;
let button = doc.getElementById("reader-mode-button");
let menuitem = doc.getElementById("menu_readerModeItem");
let key = doc.getElementById("key_toggleReaderMode");
let win = browser.ownerGlobal;
let button = win.document.getElementById("reader-mode-button");
let menuitem = win.document.getElementById("menu_readerModeItem");
let key = win.document.getElementById("key_toggleReaderMode");
if (this.isReaderMode()) {
gAllActors.add(this);
let closeText = gStringBundle.GetStringFromName("readerView.close");
button.setAttribute("readeractive", true);
button.hidden = false;
doc.l10n.setAttributes(button, "reader-view-close-button");
button.setAttribute("aria-label", closeText);
menuitem.setAttribute("label", closeText);
menuitem.hidden = false;
doc.l10n.setAttributes(menuitem, "reader-view-close-menuitem");
menuitem.setAttribute(
"accesskey",
gStringBundle.GetStringFromName("readerView.close.accesskey")
);
key.setAttribute("disabled", false);
Services.obs.notifyObservers(null, "reader-mode-available");
} else {
let enterText = gStringBundle.GetStringFromName("readerView.enter");
button.removeAttribute("readeractive");
button.hidden = !browser.isArticle;
doc.l10n.setAttributes(button, "reader-view-enter-button");
button.setAttribute("aria-label", enterText);
menuitem.setAttribute("label", enterText);
menuitem.hidden = !browser.isArticle;
doc.l10n.setAttributes(menuitem, "reader-view-enter-menuitem");
menuitem.setAttribute(
"accesskey",
gStringBundle.GetStringFromName("readerView.enter.accesskey")
);
key.setAttribute("disabled", !browser.isArticle);

View File

@ -211,7 +211,6 @@
<menuitem id="menu_readerModeItem"
observes="View:ReaderView"
key="key_toggleReaderMode"
data-l10n-id="reader-view-enter-menuitem"
hidden="true"/>
<menuitem id="menu_showAllTabs"
hidden="true"

View File

@ -354,7 +354,6 @@
<hbox id="reader-mode-button"
class="urlbar-page-action"
role="button"
data-l10n-id="reader-view-enter-button"
hidden="true"
tooltip="dynamic-shortcut-tooltip"
onclick="AboutReaderParent.buttonClick(event);">

View File

@ -25,6 +25,9 @@ ChromeUtils.defineESModuleGetters(lazy, {
var EXPORTED_SYMBOLS = ["SaveToPocket"];
const gStrings = Services.strings.createBundle(
"chrome://global/locale/aboutReader.properties"
);
var PocketCustomizableWidget = {
init() {
lazy.CustomizableUI.createWidget({
@ -122,8 +125,10 @@ var SaveToPocket = {
_readerButtonData: {
id: "pocket-button",
l10nId: "about-reader-toolbar-savetopocket",
telemetryId: "save-to-pocket",
label: gStrings.formatStringFromName("readerView.savetopocket.label", [
"Pocket",
]),
image: "chrome://global/skin/icons/pocket.svg",
},

View File

@ -640,21 +640,6 @@ urlbar-group-search-suggestions =
urlbar-group-quickactions =
.label = Quick Actions
## Reader View toolbar & menubar items
## These menu items may use the same accesskey.
reader-view-enter-button =
.aria-label = Enter Reader View
reader-view-enter-menuitem =
.label = Enter Reader View
.accesskey = R
reader-view-close-button =
.aria-label = Close Reader View
reader-view-close-menuitem =
.label = Close Reader View
.accesskey = R
## Full Screen and Pointer Lock UI
# Please ensure that the domain stays in the `<span data-l10n-name="domain">` markup.

View File

@ -20,6 +20,7 @@ def test(mod, path, entity=None):
if mod == "toolkit":
# keep this file list in sync with jar.mn
if path in (
"chrome/global/aboutReader.properties",
"chrome/global/commonDialogs.properties",
"chrome/global/intl.properties",
"chrome/global/intl.css",

View File

@ -15,6 +15,7 @@
# overrides for toolkit l10n, also for en-US
# keep this file list in sync with l10n.toml and filter.py
relativesrcdir toolkit/locales:
locale/@AB_CD@/browser/overrides/aboutReader.properties (%chrome/global/aboutReader.properties)
locale/@AB_CD@/browser/overrides/commonDialogs.properties (%chrome/global/commonDialogs.properties)
locale/@AB_CD@/browser/overrides/intl.properties (%chrome/global/intl.properties)
locale/@AB_CD@/browser/overrides/intl.css (%chrome/global/intl.css)

View File

@ -145,6 +145,10 @@ exclude-multi-locale = [
reference = "toolkit/locales/en-US/toolkit/about/*Mozilla.ftl"
l10n = "{l}toolkit/toolkit/about/*Mozilla.ftl"
[[paths]]
reference = "toolkit/locales/en-US/chrome/global/aboutReader.properties"
l10n = "{l}toolkit/chrome/global/aboutReader.properties"
[[paths]]
reference = "toolkit/locales/en-US/toolkit/about/*Rights.ftl"
l10n = "{l}toolkit/toolkit/about/*Rights.ftl"

View File

@ -20,6 +20,7 @@ def test(mod, path, entity=None):
if mod == "toolkit":
# keep this file list in sync with jar.mn
if path in (
"chrome/global/aboutReader.properties",
"chrome/global/commonDialogs.properties",
"chrome/global/intl.properties",
"chrome/global/intl.css",

View File

@ -1,170 +0,0 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
import fluent.syntax.ast as FTL
from fluent.migrate.helpers import TERM_REFERENCE, VARIABLE_REFERENCE
from fluent.migrate.transforms import COPY, PLURALS, REPLACE, REPLACE_IN_TEXT
def migrate(ctx):
"""Bug 1760033 - Convert aboutReader.html to Fluent, part {index}."""
source = "toolkit/chrome/global/aboutReader.properties"
target = "toolkit/toolkit/about/aboutReader.ftl"
ctx.add_transforms(
target,
target,
[
FTL.Message(
id=FTL.Identifier("about-reader-loading"),
value=COPY(source, "aboutReader.loading2"),
),
FTL.Message(
id=FTL.Identifier("about-reader-load-error"),
value=COPY(source, "aboutReader.loadError"),
),
FTL.Message(
id=FTL.Identifier("about-reader-color-scheme-light"),
value=COPY(source, "aboutReader.colorScheme.light"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("title"),
value=COPY(source, "aboutReader.toolbar.colorschemelight"),
)
],
),
FTL.Message(
id=FTL.Identifier("about-reader-color-scheme-dark"),
value=COPY(source, "aboutReader.colorScheme.dark"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("title"),
value=COPY(source, "aboutReader.toolbar.colorschemedark"),
)
],
),
FTL.Message(
id=FTL.Identifier("about-reader-color-scheme-sepia"),
value=COPY(source, "aboutReader.colorScheme.sepia"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("title"),
value=COPY(source, "aboutReader.toolbar.colorschemesepia"),
)
],
),
FTL.Message(
id=FTL.Identifier("about-reader-color-scheme-auto"),
value=COPY(source, "aboutReader.colorScheme.auto"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("title"),
value=COPY(source, "aboutReader.toolbar.colorschemeauto"),
)
],
),
FTL.Message(
id=FTL.Identifier("about-reader-estimated-read-time"),
value=PLURALS(
source,
"aboutReader.estimatedReadTimeRange1",
VARIABLE_REFERENCE("rangePlural"),
foreach=lambda n: REPLACE_IN_TEXT(
n,
{
# most locales
"#1-#2": VARIABLE_REFERENCE("range"),
# bg
"#1#2": VARIABLE_REFERENCE("range"),
# bo
"#1་ནས་#2": VARIABLE_REFERENCE("range"),
# ja ja-JP-mac
"#1 #2": VARIABLE_REFERENCE("range"),
# kab
"#1 -#2": VARIABLE_REFERENCE("range"),
# pl sk
"#1 — #2": VARIABLE_REFERENCE("range"),
},
),
),
),
FTL.Message(
id=FTL.Identifier("about-reader-font-type-serif"),
value=COPY(source, "aboutReader.fontType.serif"),
),
FTL.Message(
id=FTL.Identifier("about-reader-font-type-sans-serif"),
value=COPY(source, "aboutReader.fontType.sans-serif"),
),
FTL.Message(
id=FTL.Identifier("about-reader-toolbar-minus"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("title"),
value=COPY(source, "aboutReader.toolbar.minus"),
)
],
),
FTL.Message(
id=FTL.Identifier("about-reader-toolbar-plus"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("title"),
value=COPY(source, "aboutReader.toolbar.plus"),
)
],
),
FTL.Message(
id=FTL.Identifier("about-reader-toolbar-contentwidthminus"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("title"),
value=COPY(source, "aboutReader.toolbar.contentwidthminus"),
)
],
),
FTL.Message(
id=FTL.Identifier("about-reader-toolbar-contentwidthplus"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("title"),
value=COPY(source, "aboutReader.toolbar.contentwidthplus"),
)
],
),
FTL.Message(
id=FTL.Identifier("about-reader-toolbar-lineheightminus"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("title"),
value=COPY(source, "aboutReader.toolbar.lineheightminus"),
)
],
),
FTL.Message(
id=FTL.Identifier("about-reader-toolbar-lineheightplus"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("title"),
value=COPY(source, "aboutReader.toolbar.lineheightplus"),
)
],
),
FTL.Message(
id=FTL.Identifier("about-reader-toolbar-close"),
value=COPY(source, "aboutReader.toolbar.close"),
),
FTL.Message(
id=FTL.Identifier("about-reader-toolbar-type-controls"),
value=COPY(source, "aboutReader.toolbar.typeControls"),
),
FTL.Message(
id=FTL.Identifier("about-reader-toolbar-savetopocket"),
value=REPLACE(
source,
"readerView.savetopocket.label",
{"%1$S": TERM_REFERENCE("pocket-brand-name")},
),
),
],
)

View File

@ -1,62 +0,0 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
import fluent.syntax.ast as FTL
from fluent.migrate.transforms import COPY
def migrate(ctx):
"""Bug 1760033 - Convert AboutReaderParent.jsm to Fluent, part {index}."""
source = "toolkit/chrome/global/aboutReader.properties"
target = "browser/browser/browser.ftl"
ctx.add_transforms(
target,
target,
[
FTL.Message(
id=FTL.Identifier("reader-view-enter-button"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("aria-label"),
value=COPY(source, "readerView.enter"),
),
],
),
FTL.Message(
id=FTL.Identifier("reader-view-enter-menuitem"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("label"),
value=COPY(source, "readerView.enter"),
),
FTL.Attribute(
id=FTL.Identifier("accesskey"),
value=COPY(source, "readerView.enter.accesskey"),
),
],
),
FTL.Message(
id=FTL.Identifier("reader-view-close-button"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("aria-label"),
value=COPY(source, "readerView.close"),
),
],
),
FTL.Message(
id=FTL.Identifier("reader-view-close-menuitem"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("label"),
value=COPY(source, "readerView.close"),
),
FTL.Attribute(
id=FTL.Identifier("accesskey"),
value=COPY(source, "readerView.close.accesskey"),
),
],
),
],
)

View File

@ -243,8 +243,12 @@ class PrintingChild extends JSWindowActorChild {
// Display reader content element
readerContent.style.display = "block";
} else {
const l10n = new Localization(["toolkit/about/aboutReader.ftl"], true);
const errorMessage = l10n.formatValueSync("about-reader-load-error");
let aboutReaderStrings = Services.strings.createBundle(
"chrome://global/locale/aboutReader.properties"
);
let errorMessage = aboutReaderStrings.GetStringFromName(
"aboutReader.loadError"
);
document.title = errorMessage;

View File

@ -13,10 +13,6 @@ const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
@ -27,29 +23,20 @@ ChromeUtils.defineModuleGetter(
"NarrateControls",
"resource://gre/modules/narrate/NarrateControls.jsm"
);
ChromeUtils.defineModuleGetter(
lazy,
"PluralForm",
"resource://gre/modules/PluralForm.jsm"
);
ChromeUtils.defineModuleGetter(
lazy,
"NimbusFeatures",
"resource://nimbus/ExperimentAPI.jsm"
);
XPCOMUtils.defineLazyGetter(
lazy,
"numberFormat",
() => new Services.intl.NumberFormat(undefined)
var gStrings = Services.strings.createBundle(
"chrome://global/locale/aboutReader.properties"
);
XPCOMUtils.defineLazyGetter(
lazy,
"pluralRules",
() => new Services.intl.PluralRules(undefined)
);
const COLORSCHEME_L10N_IDS = {
light: "about-reader-color-scheme-light",
dark: "about-reader-color-scheme-dark",
sepia: "about-reader-color-scheme-sepia",
auto: "about-reader-color-scheme-auto",
};
Services.telemetry.setEventRecordingEnabled("readermode", true);
@ -169,7 +156,11 @@ var AboutReader = function(
Services.obs.addObserver(this, "inner-window-destroyed");
this._setupButton("close-button", this._onReaderClose.bind(this));
this._setupButton(
"close-button",
this._onReaderClose.bind(this),
"aboutReader.toolbar.close"
);
// we're ready for any external setup, send a signal for that.
this._actor.sendAsyncMessage("Reader:OnSetup");
@ -177,12 +168,14 @@ var AboutReader = function(
let colorSchemeValues = JSON.parse(
Services.prefs.getCharPref("reader.color_scheme.values")
);
let colorSchemeOptions = colorSchemeValues.map(value => ({
l10nId: COLORSCHEME_L10N_IDS[value],
groupName: "color-scheme",
value,
itemClass: value + "-button",
}));
let colorSchemeOptions = colorSchemeValues.map(value => {
return {
name: gStrings.GetStringFromName("aboutReader.colorScheme." + value),
groupName: "color-scheme",
value,
itemClass: value + "-button",
};
});
let colorScheme = Services.prefs.getCharPref("reader.color_scheme");
this._setupSegmentedButton(
@ -193,15 +186,21 @@ var AboutReader = function(
);
this._setColorSchemePref(colorScheme);
let styleButton = this._doc.querySelector(".style-button");
this._setButtonTip(styleButton, "aboutReader.toolbar.typeControls");
// See bug 1637089.
// let fontTypeSample = gStrings.GetStringFromName("aboutReader.fontTypeSample");
let fontTypeOptions = [
{
l10nId: "about-reader-font-type-sans-serif",
name: gStrings.GetStringFromName("aboutReader.fontType.sans-serif"),
groupName: "font-type",
value: "sans-serif",
itemClass: "sans-serif-button",
},
{
l10nId: "about-reader-font-type-serif",
name: gStrings.GetStringFromName("aboutReader.fontType.serif"),
groupName: "font-type",
value: "serif",
itemClass: "serif-button",
@ -232,6 +231,30 @@ var AboutReader = function(
}
this._loadArticle(docContentType);
let dropdown = this._toolbarElement;
let elemL10nMap = {
".minus-button": "minus",
".plus-button": "plus",
".content-width-minus-button": "contentwidthminus",
".content-width-plus-button": "contentwidthplus",
".line-height-minus-button": "lineheightminus",
".line-height-plus-button": "lineheightplus",
".light-button": "colorschemelight",
".dark-button": "colorschemedark",
".sepia-button": "colorschemesepia",
".auto-button": "colorschemeauto",
};
for (let [selector, stringID] of Object.entries(elemL10nMap)) {
dropdown
.querySelector(selector)
?.setAttribute(
"title",
gStrings.GetStringFromName("aboutReader.toolbar." + stringID)
);
}
};
AboutReader.prototype = {
@ -308,28 +331,30 @@ AboutReader.prototype = {
));
},
receiveMessage({ data, name }) {
const doc = this._doc;
switch (name) {
receiveMessage(message) {
switch (message.name) {
case "Reader:AddButton": {
if (data.id && data.image && !doc.getElementsByClassName(data.id)[0]) {
let btn = doc.createElement("button");
btn.dataset.buttonid = data.id;
btn.dataset.telemetryId = `reader-${data.telemetryId}`;
btn.className = "toolbar-button " + data.id;
btn.setAttribute("aria-labelledby", "label-" + data.id);
let tip = doc.createElement("span");
if (
message.data.id &&
message.data.image &&
!this._doc.getElementsByClassName(message.data.id)[0]
) {
let btn = this._doc.createElement("button");
btn.dataset.buttonid = message.data.id;
btn.dataset.telemetryId = `reader-${message.data.telemetryId}`;
btn.className = "toolbar-button " + message.data.id;
let tip = this._doc.createElement("span");
tip.className = "hover-label";
tip.id = "label-" + data.id;
doc.l10n.setAttributes(tip, data.l10nId);
tip.textContent = message.data.label;
btn.append(tip);
btn.style.backgroundImage = "url('" + data.image + "')";
if (data.width && data.height) {
btn.style.backgroundSize = `${data.width}px ${data.height}px`;
btn.setAttribute("aria-label", message.data.label);
btn.style.backgroundImage = "url('" + message.data.image + "')";
if (message.data.width && message.data.height) {
btn.style.backgroundSize = `${message.data.width}px ${message.data.height}px`;
}
let tb = this._toolbarElement;
tb.appendChild(btn);
this._setupButton(data.id, button => {
this._setupButton(message.data.id, button => {
this._actor.sendAsyncMessage(
"Reader:Clicked-" + button.dataset.buttonid,
{ article: this._article }
@ -339,8 +364,8 @@ AboutReader.prototype = {
break;
}
case "Reader:RemoveButton": {
if (data.id) {
let btn = doc.getElementsByClassName(data.id)[0];
if (message.data.id) {
let btn = this._doc.getElementsByClassName(message.data.id)[0];
if (btn) {
btn.remove();
}
@ -968,20 +993,32 @@ AboutReader.prototype = {
this._toolbarElement.setAttribute("articledir", article.dir || "ltr");
},
_formatReadTime(slowEstimate, fastEstimate) {
let displayStringKey = "aboutReader.estimatedReadTimeRange1";
// only show one reading estimate when they are the same value
if (slowEstimate == fastEstimate) {
displayStringKey = "aboutReader.estimatedReadTimeValue1";
}
return lazy.PluralForm.get(
slowEstimate,
gStrings.GetStringFromName(displayStringKey)
)
.replace("#1", fastEstimate)
.replace("#2", slowEstimate);
},
_showError() {
this._headerElement.classList.remove("reader-show-element");
this._contentElement.classList.remove("reader-show-element");
this._doc.l10n.setAttributes(
this._messageElement,
"about-reader-load-error"
);
this._doc.l10n.setAttributes(
this._doc.getElementById("reader-title"),
"about-reader-load-error"
);
let errorMessage = gStrings.GetStringFromName("aboutReader.loadError");
this._messageElement.textContent = errorMessage;
this._messageElement.style.display = "block";
this._doc.title = errorMessage;
this._doc.documentElement.dataset.isError = true;
this._error = true;
@ -1034,19 +1071,9 @@ AboutReader.prototype = {
this._creditsElement.textContent = article.byline;
this._titleElement.textContent = article.title;
const slow = article.readingTimeMinsSlow;
const fast = article.readingTimeMinsFast;
this._doc.l10n.setAttributes(
this._readTimeElement,
"about-reader-estimated-read-time",
{
range: lazy.numberFormat.formatRange(fast, slow),
rangePlural:
slow === fast
? lazy.pluralRules.select(fast) // workaround for https://github.com/tc39/proposal-intl-numberformat-v3/issues/64
: lazy.pluralRules.selectRange(fast, slow),
}
this._readTimeElement.textContent = this._formatReadTime(
article.readingTimeMinsSlow,
article.readingTimeMinsFast
);
// If a document title was not provided in the constructor, we'll fall back
@ -1114,9 +1141,8 @@ AboutReader.prototype = {
this._headerElement.classList.remove("reader-show-element");
this._contentElement.classList.remove("reader-show-element");
this._doc.l10n.setAttributes(
this._messageElement,
"about-reader-loading"
this._messageElement.textContent = gStrings.GetStringFromName(
"aboutReader.loading2"
);
this._messageElement.classList.add("reader-show-element");
}, 300);
@ -1143,9 +1169,9 @@ AboutReader.prototype = {
segmentedButton.appendChild(radioButton);
let item = doc.createElement("label");
item.textContent = option.name;
item.htmlFor = radioButton.id;
item.classList.add(option.itemClass);
doc.l10n.setAttributes(item, option.l10nId);
segmentedButton.appendChild(item);
@ -1174,8 +1200,12 @@ AboutReader.prototype = {
}
},
_setupButton(id, callback) {
_setupButton(id, callback, titleEntity) {
let button = this._doc.querySelector("." + id);
if (titleEntity) {
this._setButtonTip(button, titleEntity);
}
button.removeAttribute("hidden");
button.addEventListener(
"click",
@ -1191,6 +1221,19 @@ AboutReader.prototype = {
);
},
/**
* Sets a tooltip-style label on a button.
* @param Localizable string providing UI element usage tip.
*/
_setButtonTip(button, titleEntity) {
let tip = this._doc.createElement("span");
let localizedString = gStrings.GetStringFromName(titleEntity);
tip.textContent = localizedString;
tip.className = "hover-label";
button.setAttribute("aria-label", localizedString);
button.append(tip);
},
_toggleDropdownClicked(event) {
let dropdown = event.target.closest(".dropdown");

View File

@ -6,14 +6,11 @@
<html>
<head>
<title id="reader-title"></title>
<meta http-equiv="Content-Security-Policy" content="default-src chrome:; img-src data: *; media-src *; object-src 'none'" />
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
<meta name="viewport" content="width=device-width; user-scalable=0" />
<link rel="stylesheet" href="chrome://global/skin/aboutReader.css" type="text/css"/>
<link rel="stylesheet" href="chrome://global/skin/aboutReaderPocket.css" type="text/css"/>
<link rel="localization" href="toolkit/about/aboutReader.ftl"/>
<link rel="localization" href="browser/branding/brandings.ftl"/>
</head>
<body>
@ -22,32 +19,28 @@
<div id="toolbar" class="toolbar-container">
<div class="toolbar reader-toolbar">
<div class="reader-controls">
<button class="close-button toolbar-button" aria-labelledby="toolbar-close" data-telemetry-id="reader-close">
<span class="hover-label" id="toolbar-close" data-l10n-id="about-reader-toolbar-close"></span>
</button>
<button class="close-button toolbar-button" data-telemetry-id="reader-close"></button>
<ul class="dropdown style-dropdown">
<li>
<button class="dropdown-toggle toolbar-button style-button" aria-labelledby="toolbar-type-controls" data-telemetry-id="reader-type-controls">
<span class="hover-label" id="toolbar-type-controls" data-l10n-id="about-reader-toolbar-type-controls"></span>
</button>
<button class="dropdown-toggle toolbar-button style-button" data-telemetry-id="reader-type-controls"></button>
</li>
<li class="dropdown-popup">
<div class="dropdown-arrow"></div>
<div class="font-type-buttons radiorow"></div>
<div class="font-size-buttons buttonrow">
<button class="minus-button" data-l10n-id="about-reader-toolbar-minus"></button>
<button class="minus-button"></button>
<span class="font-size-value"></span>
<button class="plus-button" data-l10n-id="about-reader-toolbar-plus"></button>
<button class="plus-button"/>
</div>
<div class="content-width-buttons buttonrow">
<button class="content-width-minus-button" data-l10n-id="about-reader-toolbar-contentwidthminus"></button>
<button class="content-width-minus-button"></button>
<span class="content-width-value"></span>
<button class="content-width-plus-button" data-l10n-id="about-reader-toolbar-contentwidthplus"></button>
<button class="content-width-plus-button"/>
</div>
<div class="line-height-buttons buttonrow">
<button class="line-height-minus-button" data-l10n-id="about-reader-toolbar-lineheightminus"></button>
<button class="line-height-minus-button"></button>
<span class="line-height-value"></span>
<button class="line-height-plus-button" data-l10n-id="about-reader-toolbar-lineheightplus"></button>
<button class="line-height-plus-button"/>
</div>
<div class="color-scheme-buttons radiorow"></div>
</li>

View File

@ -30,10 +30,9 @@ add_task(async function() {
".reader-estimated-time"
);
ok(readingTimeElement, "Reading time element should be in document");
const args = JSON.parse(readingTimeElement.dataset.l10nArgs);
is(args.rangePlural, "other", "Reading time should be '9-12 minutes'");
ok(
/\b9\b.*\b12\b/.test(args.range),
is(
readingTimeElement.textContent,
"9-12 minutes",
"Reading time should be '9-12 minutes'"
);
});
@ -62,9 +61,11 @@ add_task(async function() {
".reader-estimated-time"
);
ok(readingTimeElement, "Reading time element should be in document");
const args = JSON.parse(readingTimeElement.dataset.l10nArgs);
is(args.rangePlural, "one", "Reading time should be '~1 minute'");
ok(/\b1\b/.test(args.range), "Reading time should be '~1 minute'");
is(
readingTimeElement.textContent,
"1 minute",
"Reading time should be '1 minute'"
);
});
}
);
@ -92,9 +93,11 @@ add_task(async function() {
".reader-estimated-time"
);
ok(readingTimeElement, "Reading time element should be in document");
const args = JSON.parse(readingTimeElement.dataset.l10nArgs);
is(args.rangePlural, "other", "Reading time should be '~3 minutes'");
ok(/\b3\b/.test(args.range), "Reading time should be '~3 minutes'");
is(
readingTimeElement.textContent,
"3 minutes",
"Reading time should be '3 minutes'"
);
});
}
);

View File

@ -0,0 +1,67 @@
# 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/.
#LOCALIZATION NOTE (aboutReader.loading2):
# Use the unicode ellipsis char, \u2026,
# or use "..." if \u2026 doesn't suit traditions in your locale.
aboutReader.loading2=Loading…
aboutReader.loadError=Failed to load article from page
aboutReader.colorScheme.light=Light
aboutReader.colorScheme.dark=Dark
aboutReader.colorScheme.sepia=Sepia
aboutReader.colorScheme.auto=Auto
# LOCALIZATION NOTE (aboutReader.estimatedReadTimeValue1): Semi-colon list of plural forms.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
# #1 is the number of minutes it is estimated to take to read the article
# example: `3 minutes`
aboutReader.estimatedReadTimeValue1=#1 minute;#1 minutes
#LOCALIZATION NOTE (aboutReader.estimatedReadTimeRange1): Semi-colon list of plural forms.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
# When there is some uncertainty in how long the article will take to read show a range of
# minutes it is expected to take.
# #1 is the number of minutes it is estimated to take to read the article for a fast reader
# #2 is the number of minutes it is estimated to take to read the article for a slow reader
# #2 is the variable used to determine the plural form to use.
# example: `5-8 minutes`
aboutReader.estimatedReadTimeRange1=#1-#2 minute;#1-#2 minutes
# LOCALIZATION NOTE (aboutReader.fontType.serif, aboutReader.fontType.sans-serif):
# These are the styles of typeface that are options in the reader view controls.
aboutReader.fontType.serif=Serif
aboutReader.fontType.sans-serif=Sans-serif
# LOCALIZATION NOTE (aboutReader.fontTypeSample): String used to sample font types.
# For followup see: https://bugzilla.mozilla.org/show_bug.cgi?id=1637089
aboutReader.fontTypeSample=Aa
aboutReader.toolbar.close=Close Reader View
aboutReader.toolbar.typeControls=Type controls
# This is used as a label for the Reader View toolbar button.
# This is a label used for the Save to Pocket option in the toolbar.
# %S is replaced by Pocket.
readerView.savetopocket.label=Save To %S
# This is a label used for done option in the toolbar
readerView.done.label=Done
# These are used for the Reader View toolbar button and the menuitem within the
# View menu.
readerView.enter=Enter Reader View
readerView.enter.accesskey=R
readerView.close=Close Reader View
readerView.close.accesskey=R
# These are used as tooltips in Type Control
aboutReader.toolbar.minus = Decrease Font Size
aboutReader.toolbar.plus = Increase Font Size
aboutReader.toolbar.contentwidthminus = Decrease Content Width
aboutReader.toolbar.contentwidthplus = Increase Content Width
aboutReader.toolbar.lineheightminus = Decrease Line Height
aboutReader.toolbar.lineheightplus = Increase Line Height
aboutReader.toolbar.colorschemelight = Color Scheme Light
aboutReader.toolbar.colorschemedark = Color Scheme Dark
aboutReader.toolbar.colorschemesepia = Color Scheme Sepia
aboutReader.toolbar.colorschemeauto = Color Scheme Auto

View File

@ -1,52 +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/.
about-reader-loading = Loading…
about-reader-load-error = Failed to load article from page
about-reader-color-scheme-light = Light
.title = Color Scheme Light
about-reader-color-scheme-dark = Dark
.title = Color Scheme Dark
about-reader-color-scheme-sepia = Sepia
.title = Color Scheme Sepia
about-reader-color-scheme-auto = Auto
.title = Color Scheme Auto
# An estimate for how long it takes to read an article,
# expressed as a range covering both slow and fast readers.
# Variables:
# $rangePlural (String): The plural category of the range, using the same set as for numbers.
# $range (String): The range of minutes as a localised string. Examples: "3-7", "~1".
about-reader-estimated-read-time =
{ $rangePlural ->
[one] { $range } minute
*[other] { $range } minutes
}
## These are used as tooltips in Type Control
about-reader-toolbar-minus =
.title = Decrease Font Size
about-reader-toolbar-plus =
.title = Increase Font Size
about-reader-toolbar-contentwidthminus =
.title = Decrease Content Width
about-reader-toolbar-contentwidthplus =
.title = Increase Content Width
about-reader-toolbar-lineheightminus =
.title = Decrease Line Height
about-reader-toolbar-lineheightplus =
.title = Increase Line Height
## These are the styles of typeface that are options in the reader view controls.
about-reader-font-type-serif = Serif
about-reader-font-type-sans-serif = Sans-serif
## Reader View toolbar buttons
about-reader-toolbar-close = Close Reader View
about-reader-toolbar-type-controls = Type controls
about-reader-toolbar-savetopocket = Save To { -pocket-brand-name }

View File

@ -12,6 +12,7 @@
@AB_CD@.jar:
% locale global @AB_CD@ %locale/@AB_CD@/global/
locale/@AB_CD@/global/aboutReader.properties (%chrome/global/aboutReader.properties)
locale/@AB_CD@/global/aboutStudies.properties (%chrome/global/aboutStudies.properties)
locale/@AB_CD@/global/autocomplete.properties (%chrome/global/autocomplete.properties)
locale/@AB_CD@/global/browser.properties (%chrome/global/browser.properties)