Bug 1523737 - Migrate printProgress.dtd, printPageSetup.dtd, and printPreviewProgress.dtd to Fluent, r=jaws,flod

Differential Revision: https://phabricator.services.mozilla.com/D19322

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Yuan Cheng 2019-02-19 17:59:05 +00:00
Родитель fe6bbffa96
Коммит 12a33aae75
13 изменённых файлов: 430 добавлений и 300 удалений

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

@ -69,10 +69,8 @@ var whitelist = [
// See bug 1339424 for why this is hard to fix.
{file: "chrome://global/locale/fallbackMenubar.properties",
platforms: ["linux", "win"]},
{file: "chrome://global/locale/printPageSetup.dtd", platforms: ["linux", "macosx"]},
{file: "chrome://global/locale/printPreviewProgress.dtd",
{file: "resource://gre/localization/en-US/toolkit/printing/printDialogs.ftl",
platforms: ["macosx"]},
{file: "chrome://global/locale/printProgress.dtd", platforms: ["macosx"]},
// toolkit/content/aboutRights-unbranded.xhtml doesn't use aboutRights.css
{file: "chrome://global/skin/aboutRights.css", skipUnofficial: true},

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

@ -0,0 +1,204 @@
# 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 import COPY
from fluent.migrate import REPLACE
from fluent.migrate.helpers import transforms_from
from fluent.migrate.helpers import MESSAGE_REFERENCE
from fluent.migrate.helpers import VARIABLE_REFERENCE
def migrate(ctx):
"""Bug 1523737 - Migrate printProgress.dtd, printPageSetup.dtd, and printPreviewProgress.dtd to Fluent, part {index}."""
ctx.add_transforms(
"toolkit/toolkit/printing/printDialogs.ftl",
"toolkit/toolkit/printing/printDialogs.ftl",
transforms_from(
"""
print-setup =
.title = { COPY(from_path, "printSetup.title") }
custom-prompt-title = { COPY(from_path, "customPrompt.title") }
custom-prompt-prompt = { COPY(from_path, "customPrompt.prompt") }
basic-tab =
.label = { COPY(from_path, "basic.tab") }
advanced-tab =
.label = { COPY(from_path, "advanced.tab") }
format-group-label =
.value = { COPY(from_path, "formatGroup.label") }
orientation-label =
.value = { COPY(from_path, "orientation.label") }
portrait =
.label = { COPY(from_path, "portrait.label") }
.accesskey = { COPY(from_path, "portrait.accesskey") }
landscape =
.label = { COPY(from_path, "landscape.label") }
.accesskey = { COPY(from_path, "landscape.accesskey") }
scale =
.label = { COPY(from_path, "scale.label") }
.accesskey = { COPY(from_path, "scale.accesskey") }
scale-percent =
.value = { COPY(from_path, "scalePercent") }
shrink-to-fit =
.label = { COPY(from_path, "shrinkToFit.label") }
.accesskey = { COPY(from_path, "shrinkToFit.accesskey") }
options-group-label =
.value = { COPY(from_path, "optionsGroup.label") }
print-bg =
.label = { COPY(from_path, "printBG.label") }
.accesskey = { COPY(from_path, "printBG.accesskey") }
margin-top =
.value = { COPY(from_path, "marginTop.label") }
.accesskey = { COPY(from_path, "marginTop.accesskey") }
margin-top-invisible =
.value = { COPY(from_path, "marginTop.label") }
margin-bottom =
.value = { COPY(from_path, "marginBottom.label") }
.accesskey = { COPY(from_path, "marginBottom.accesskey") }
margin-bottom-invisible =
.value = { COPY(from_path, "marginBottom.label") }
margin-left =
.value = { COPY(from_path, "marginLeft.label") }
.accesskey = { COPY(from_path, "marginLeft.accesskey") }
margin-left-invisible =
.value = { COPY(from_path, "marginLeft.label") }
margin-right =
.value = { COPY(from_path, "marginRight.label") }
.accesskey = { COPY(from_path, "marginRight.accesskey") }
margin-right-invisible =
.value = { COPY(from_path, "marginRight.label") }
header-footer-label =
.value = { COPY(from_path, "headerFooter.label") }
hf-left-label =
.value = { COPY(from_path, "hfLeft.label") }
hf-center-label =
.value = { COPY(from_path, "hfCenter.label") }
hf-right-label =
.value = { COPY(from_path, "hfRight.label") }
header-left-tip =
.tooltiptext = { COPY(from_path, "headerLeft.tip") }
header-center-tip =
.tooltiptext = { COPY(from_path, "headerCenter.tip") }
header-right-tip =
.tooltiptext = { COPY(from_path, "headerRight.tip") }
footer-left-tip =
.tooltiptext = { COPY(from_path, "footerLeft.tip") }
footer-center-tip =
.tooltiptext = { COPY(from_path, "footerCenter.tip") }
footer-right-tip =
.tooltiptext = { COPY(from_path, "footerRight.tip") }
hf-blank =
.label = { COPY(from_path, "hfBlank") }
hf-title =
.label = { COPY(from_path, "hfTitle") }
hf-url =
.label = { COPY(from_path, "hfURL") }
hf-date-and-time =
.label = { COPY(from_path, "hfDateAndTime") }
hf-page =
.label = { COPY(from_path, "hfPage") }
hf-page-and-total =
.label = { COPY(from_path, "hfPageAndTotal") }
hf-custom =
.label = { COPY(from_path, "hfCustom") }
""", from_path="toolkit/chrome/global/printPageSetup.dtd")
)
ctx.add_transforms(
"toolkit/toolkit/printing/printDialogs.ftl",
"toolkit/toolkit/printing/printDialogs.ftl",
[
FTL.Message(
id=FTL.Identifier("margin-group-label-inches"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("value"),
value=REPLACE(
"toolkit/chrome/global/printPageSetup.dtd",
"marginGroup.label",
{
"#1": COPY("toolkit/chrome/global/printPageSetup.dtd", "marginUnits.inches")
},
)
),
]
)
]
)
ctx.add_transforms(
"toolkit/toolkit/printing/printDialogs.ftl",
"toolkit/toolkit/printing/printDialogs.ftl",
[
FTL.Message(
id=FTL.Identifier("margin-group-label-metric"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("value"),
value=REPLACE(
"toolkit/chrome/global/printPageSetup.dtd",
"marginGroup.label",
{
"#1": COPY("toolkit/chrome/global/printPageSetup.dtd", "marginUnits.metric")
},
)
),
]
)
]
)
ctx.add_transforms(
"toolkit/toolkit/printing/printDialogs.ftl",
"toolkit/toolkit/printing/printDialogs.ftl",
transforms_from(
"""
print-preview-window =
.title = { COPY(from_path, "printWindow.title") }
print-title =
.value = { COPY(from_path, "title") }
print-preparing =
.value = { COPY(from_path, "preparing") }
print-progress =
.value = { COPY(from_path, "progress") }
""", from_path="toolkit/chrome/global/printPreviewProgress.dtd")
)
ctx.add_transforms(
"toolkit/toolkit/printing/printDialogs.ftl",
"toolkit/toolkit/printing/printDialogs.ftl",
transforms_from(
"""
print-window =
.title = { COPY(from_path, "printWindow.title") }
print-complete =
.value = { COPY(from_path, "printComplete") }
dialog-cancel-label = { COPY(from_path, "dialogCancel.label") }
dialog-close-label = { COPY(from_path, "dialogClose.label") }
""", from_path="toolkit/chrome/global/printProgress.dtd")
)
ctx.add_transforms(
"toolkit/toolkit/printing/printDialogs.ftl",
"toolkit/toolkit/printing/printDialogs.ftl",
[
FTL.Message(
id=FTL.Identifier("print-percent"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("value"),
value=REPLACE(
"toolkit/chrome/global/printProgress.dtd",
"percentPrint",
{
"#1": VARIABLE_REFERENCE("percent")
},
)
),
]
)
]
)

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

@ -53,12 +53,6 @@ function initDialog() {
gDialog.scalingInput = document.getElementById("scalingInput");
gDialog.enabled = false;
gDialog.strings = [];
gDialog.strings["marginUnits.inches"] = document.getElementById("marginUnits.inches").childNodes[0].nodeValue;
gDialog.strings["marginUnits.metric"] = document.getElementById("marginUnits.metric").childNodes[0].nodeValue;
gDialog.strings["customPrompt.title"] = document.getElementById("customPrompt.title").childNodes[0].nodeValue;
gDialog.strings["customPrompt.prompt"] = document.getElementById("customPrompt.prompt").childNodes[0].nodeValue;
}
// ---------------------------------------------------
@ -141,11 +135,13 @@ function changeMargins() {
}
// ---------------------------------------------------
function customize( node ) {
async function customize( node ) {
// If selection is now "Custom..." then prompt user for custom setting.
if ( node.value == 6 ) {
var title = gDialog.strings["customPrompt.title"];
var promptText = gDialog.strings["customPrompt.prompt"];
let [title, promptText] = await document.l10n.formatValues([
{id: "custom-prompt-title"},
{id: "custom-prompt-prompt"},
]);
var result = { value: node.custom };
var ok = Services.prompt.prompt(window, title, promptText, result, null, { value: false } );
if ( ok ) {
@ -254,18 +250,16 @@ function loadDialog() {
gDialog.scalingLabel.disabled = gDialog.scalingInput.disabled = gDialog.shrinkToFit.checked;
var marginGroupLabel = gDialog.marginGroup.getAttribute("value");
if (gPrintSettings.paperSizeUnit == gPrintSettingsInterface.kPaperSizeInches) {
marginGroupLabel = marginGroupLabel.replace(/#1/, gDialog.strings["marginUnits.inches"]);
document.l10n.setAttributes(gDialog.marginGroup, "margin-group-label-inches");
gDoingMetric = false;
} else {
marginGroupLabel = marginGroupLabel.replace(/#1/, gDialog.strings["marginUnits.metric"]);
document.l10n.setAttributes(gDialog.marginGroup, "margin-group-label-metric");
// Also, set global page dimensions for A4 paper, in millimeters (assumes portrait at this point).
gPageWidth = 2100;
gPageHeight = 2970;
gDoingMetric = true;
}
gDialog.marginGroup.setAttribute("value", marginGroupLabel);
print_orientation = gPrintSettings.orientation;
print_margin_top = convertMarginInchesToUnits(gPrintSettings.marginTop, gDoingMetric);

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

@ -6,87 +6,79 @@
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://global/skin/printPageSetup.css" type="text/css"?>
<!DOCTYPE dialog SYSTEM "chrome://global/locale/printPageSetup.dtd">
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
id="printPageSetupDialog"
onload="onLoad();"
ondialogaccept="return onAccept();"
oncancel="return onCancel();"
title="&printSetup.title;"
data-l10n-id="print-setup"
persist="screenX screenY"
screenX="24" screenY="24">
<script type="application/javascript" src="chrome://global/content/printPageSetup.js"/>
<linkset>
<html:link rel="localization" href="toolkit/printing/printDialogs.ftl"/>
</linkset>
<!-- Localizable strings manipulated at run-time. -->
<data id="marginUnits.inches">&marginUnits.inches;</data>
<data id="marginUnits.metric">&marginUnits.metric;</data>
<data id="customPrompt.title">&customPrompt.title;</data>
<data id="customPrompt.prompt">&customPrompt.prompt;</data>
<script type="application/javascript" src="chrome://global/content/printPageSetup.js"/>
<tabbox flex="1">
<tabs>
<tab label="&basic.tab;"/>
<tab label="&advanced.tab;"/>
<tab data-l10n-id="basic-tab"/>
<tab data-l10n-id="advanced-tab"/>
</tabs>
<tabpanels flex="1">
<vbox>
<groupbox>
<caption><label value="&formatGroup.label;"/></caption>
<caption><label data-l10n-id="format-group-label"/></caption>
<vbox class="groupbox-body">
<hbox align="center">
<label control="orientation" value="&orientation.label;"/>
<label control="orientation" data-l10n-id="orientation-label"/>
<radiogroup id="orientation" oncommand="setOrientation()">
<hbox align="center">
<radio id="portrait"
class="portrait-page"
label="&portrait.label;"
accesskey="&portrait.accesskey;"/>
data-l10n-id="portrait"/>
<radio id="landscape"
class="landscape-page"
label="&landscape.label;"
accesskey="&landscape.accesskey;"/>
data-l10n-id="landscape"/>
</hbox>
</radiogroup>
</hbox>
<separator/>
<hbox align="center">
<label control="scalingInput"
value="&scale.label;"
accesskey="&scale.accesskey;"/>
data-l10n-id="scale"/>
<textbox id="scalingInput" size="4" oninput="checkDouble(this)"/>
<label value="&scalePercent;"/>
<label data-l10n-id="scale-percent"/>
<separator/>
<checkbox id="shrinkToFit"
label="&shrinkToFit.label;"
accesskey="&shrinkToFit.accesskey;"
data-l10n-id="shrink-to-fit"
oncommand="gDialog.scalingInput.disabled=gDialog.scalingLabel.disabled=this.checked"/>
</hbox>
</vbox>
</groupbox>
<groupbox>
<caption><label value="&optionsGroup.label;"/></caption>
<caption><label data-l10n-id="options-group-label"/></caption>
<checkbox id="printBG"
class="groupbox-body"
label="&printBG.label;"
accesskey="&printBG.accesskey;"/>
data-l10n-id="print-bg"/>
</groupbox>
</vbox>
<vbox>
<groupbox>
<caption><label id="marginGroup" value="&marginGroup.label;"/></caption>
<caption><label id="marginGroup" data-l10n-id="margin-group-label"/></caption>
<vbox class="groupbox-body">
<hbox align="center">
<spacer flex="1"/>
<label control="topInput"
value="&marginTop.label;"
accesskey="&marginTop.accesskey;"/>
data-l10n-id="margin-top"/>
<textbox id="topInput" size="5" oninput="changeMargin(this)"/>
<!-- This invisible label (with same content as the visible one!) is used
to ensure that the <textbox> is centered above the page. The same
technique is deployed for the bottom/left/right input fields, below. -->
<label value="&marginTop.label;" style="visibility: hidden;"/>
<label data-l10n-id="margin-top-invisible" style="visibility: hidden;"/>
<spacer flex="1"/>
</hbox>
<hbox dir="ltr">
@ -94,10 +86,9 @@
<vbox>
<spacer flex="1"/>
<label control="leftInput"
value="&marginLeft.label;"
accesskey="&marginLeft.accesskey;"/>
data-l10n-id="margin-left"/>
<textbox id="leftInput" size="5" oninput="changeMargin(this)"/>
<label value="&marginLeft.label;" style="visibility: hidden;"/>
<label data-l10n-id="margin-left-invisible" style="visibility: hidden;"/>
<spacer flex="1"/>
</vbox>
<!-- The "margin page" draws a simulated printout page with dashed lines
@ -116,10 +107,9 @@
<vbox>
<spacer flex="1"/>
<label control="rightInput"
value="&marginRight.label;"
accesskey="&marginRight.accesskey;"/>
data-l10n-id="margin-right"/>
<textbox id="rightInput" size="5" oninput="changeMargin(this)"/>
<label value="&marginRight.label;" style="visibility: hidden;"/>
<label data-l10n-id="margin-right-invisible" style="visibility: hidden;"/>
<spacer flex="1"/>
</vbox>
<spacer flex="1"/>
@ -127,16 +117,15 @@
<hbox align="center">
<spacer flex="1"/>
<label control="bottomInput"
value="&marginBottom.label;"
accesskey="&marginBottom.accesskey;"/>
data-l10n-id="margin-bottom"/>
<textbox id="bottomInput" size="5" oninput="changeMargin(this)"/>
<label value="&marginBottom.label;" style="visibility: hidden;"/>
<label data-l10n-id="margin-bottom-invisible" style="visibility: hidden;"/>
<spacer flex="1"/>
</hbox>
</vbox>
</groupbox>
<groupbox>
<caption><label value="&headerFooter.label;"/></caption>
<caption><label data-l10n-id="header-footer-label"/></caption>
<grid class="groupbox-body">
<columns>
<column/>
@ -145,86 +134,86 @@
</columns>
<rows>
<row dir="ltr">
<menulist id="hLeftOption" oncommand="customize(this)" tooltiptext="&headerLeft.tip;">
<menulist id="hLeftOption" oncommand="customize(this)" data-l10n-id="header-left-tip">
<menupopup>
<menuitem value="0" label="&hfBlank;"/>
<menuitem value="1" label="&hfTitle;"/>
<menuitem value="2" label="&hfURL;"/>
<menuitem value="3" label="&hfDateAndTime;"/>
<menuitem value="4" label="&hfPage;"/>
<menuitem value="5" label="&hfPageAndTotal;"/>
<menuitem value="6" label="&hfCustom;"/>
<menuitem value="0" data-l10n-id="hf-blank"/>
<menuitem value="1" data-l10n-id="hf-title"/>
<menuitem value="2" data-l10n-id="hf-url"/>
<menuitem value="3" data-l10n-id="hf-date-and-time"/>
<menuitem value="4" data-l10n-id="hf-page"/>
<menuitem value="5" data-l10n-id="hf-page-and-total"/>
<menuitem value="6" data-l10n-id="hf-custom"/>
</menupopup>
</menulist>
<menulist id="hCenterOption" oncommand="customize(this)" tooltiptext="&headerCenter.tip;">
<menulist id="hCenterOption" oncommand="customize(this)" data-l10n-id="header-center-tip">
<menupopup>
<menuitem value="0" label="&hfBlank;"/>
<menuitem value="1" label="&hfTitle;"/>
<menuitem value="2" label="&hfURL;"/>
<menuitem value="3" label="&hfDateAndTime;"/>
<menuitem value="4" label="&hfPage;"/>
<menuitem value="5" label="&hfPageAndTotal;"/>
<menuitem value="6" label="&hfCustom;"/>
<menuitem value="0" data-l10n-id="hf-blank"/>
<menuitem value="1" data-l10n-id="hf-title"/>
<menuitem value="2" data-l10n-id="hf-url"/>
<menuitem value="3" data-l10n-id="hf-date-and-time"/>
<menuitem value="4" data-l10n-id="hf-page"/>
<menuitem value="5" data-l10n-id="hf-page-and-total"/>
<menuitem value="6" data-l10n-id="hf-custom"/>
</menupopup>
</menulist>
<menulist id="hRightOption" oncommand="customize(this)" tooltiptext="&headerRight.tip;">
<menulist id="hRightOption" oncommand="customize(this)" data-l10n-id="header-right-tip">
<menupopup>
<menuitem value="0" label="&hfBlank;"/>
<menuitem value="1" label="&hfTitle;"/>
<menuitem value="2" label="&hfURL;"/>
<menuitem value="3" label="&hfDateAndTime;"/>
<menuitem value="4" label="&hfPage;"/>
<menuitem value="5" label="&hfPageAndTotal;"/>
<menuitem value="6" label="&hfCustom;"/>
<menuitem value="0" data-l10n-id="hf-blank"/>
<menuitem value="1" data-l10n-id="hf-title"/>
<menuitem value="2" data-l10n-id="hf-url"/>
<menuitem value="3" data-l10n-id="hf-date-and-time"/>
<menuitem value="4" data-l10n-id="hf-page"/>
<menuitem value="5" data-l10n-id="hf-page-and-total"/>
<menuitem value="6" data-l10n-id="hf-custom"/>
</menupopup>
</menulist>
</row>
<row dir="ltr">
<vbox align="center">
<label value="&hfLeft.label;"/>
<label data-l10n-id="hf-left-label"/>
</vbox>
<vbox align="center">
<label value="&hfCenter.label;"/>
<label data-l10n-id="hf-center-label"/>
</vbox>
<vbox align="center">
<label value="&hfRight.label;"/>
<label data-l10n-id="hf-right-label"/>
</vbox>
</row>
<row dir="ltr">
<menulist id="fLeftOption" oncommand="customize(this)" tooltiptext="&footerLeft.tip;">
<menulist id="fLeftOption" oncommand="customize(this)" data-l10n-id="footer-left-tip">
<menupopup>
<menuitem value="0" label="&hfBlank;"/>
<menuitem value="1" label="&hfTitle;"/>
<menuitem value="2" label="&hfURL;"/>
<menuitem value="3" label="&hfDateAndTime;"/>
<menuitem value="4" label="&hfPage;"/>
<menuitem value="5" label="&hfPageAndTotal;"/>
<menuitem value="6" label="&hfCustom;"/>
<menuitem value="0" data-l10n-id="hf-blank"/>
<menuitem value="1" data-l10n-id="hf-title"/>
<menuitem value="2" data-l10n-id="hf-url"/>
<menuitem value="3" data-l10n-id="hf-date-and-time"/>
<menuitem value="4" data-l10n-id="hf-page"/>
<menuitem value="5" data-l10n-id="hf-page-and-total"/>
<menuitem value="6" data-l10n-id="hf-custom"/>
</menupopup>
</menulist>
<menulist id="fCenterOption" oncommand="customize(this)" tooltiptext="&footerCenter.tip;">
<menulist id="fCenterOption" oncommand="customize(this)" data-l10n-id="footer-center-tip">
<menupopup>
<menuitem value="0" label="&hfBlank;"/>
<menuitem value="1" label="&hfTitle;"/>
<menuitem value="2" label="&hfURL;"/>
<menuitem value="3" label="&hfDateAndTime;"/>
<menuitem value="4" label="&hfPage;"/>
<menuitem value="5" label="&hfPageAndTotal;"/>
<menuitem value="6" label="&hfCustom;"/>
<menuitem value="0" data-l10n-id="hf-blank"/>
<menuitem value="1" data-l10n-id="hf-title"/>
<menuitem value="2" data-l10n-id="hf-url"/>
<menuitem value="3" data-l10n-id="hf-date-and-time"/>
<menuitem value="4" data-l10n-id="hf-page"/>
<menuitem value="5" data-l10n-id="hf-page-and-total"/>
<menuitem value="6" data-l10n-id="hf-custom"/>
</menupopup>
</menulist>
<menulist id="fRightOption" oncommand="customize(this)" tooltiptext="&footerRight.tip;">
<menulist id="fRightOption" oncommand="customize(this)" data-l10n-id="footer-right-tip">
<menupopup>
<menuitem value="0" label="&hfBlank;"/>
<menuitem value="1" label="&hfTitle;"/>
<menuitem value="2" label="&hfURL;"/>
<menuitem value="3" label="&hfDateAndTime;"/>
<menuitem value="4" label="&hfPage;"/>
<menuitem value="5" label="&hfPageAndTotal;"/>
<menuitem value="6" label="&hfCustom;"/>
<menuitem value="0" data-l10n-id="hf-blank"/>
<menuitem value="1" data-l10n-id="hf-title"/>
<menuitem value="2" data-l10n-id="hf-url"/>
<menuitem value="3" data-l10n-id="hf-date-and-time"/>
<menuitem value="4" data-l10n-id="hf-page"/>
<menuitem value="5" data-l10n-id="hf-page-and-total"/>
<menuitem value="6" data-l10n-id="hf-custom"/>
</menupopup>
</menulist>
</row>
</row>
</rows>
</grid>
</groupbox>

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

@ -111,23 +111,6 @@ function onUnload() {
} catch (e) {}
}
function getString(stringId) {
// Check if we've fetched this string already.
if (!(stringId in dialog.strings)) {
// Try to get it.
var elem = document.getElementById( "dialog.strings." + stringId);
try {
if (elem && elem.childNodes && elem.childNodes[0] &&
elem.childNodes[0].nodeValue)
dialog.strings[stringId] = elem.childNodes[0].nodeValue;
// If unable to fetch string, use an empty string.
else
dialog.strings[stringId] = "";
} catch (e) { dialog.strings[stringId] = ""; }
}
return dialog.strings[stringId];
}
// If the user presses cancel, tell the app launcher and close the dialog...
function onCancel() {
// Cancel app launcher.

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

@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version="1.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
@ -6,16 +6,19 @@
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://global/locale/printPreviewProgress.dtd">
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&printWindow.title;"
xmlns:html="http://www.w3.org/1999/xhtml"
data-l10n-id="print-preview-window"
style="width: 36em;"
buttons="cancel"
oncancel="onCancel()"
onload="onLoad()"
onunload="onUnload()">
<linkset>
<html:link rel="localization" href="toolkit/printing/printDialogs.ftl"/>
</linkset>
<script type="application/javascript" src="chrome://global/content/printPreviewProgress.js"/>
<grid flex="1">
@ -23,19 +26,19 @@
<column/>
<column/>
</columns>
<rows>
<row>
<hbox pack="end">
<label id="dialog.titleLabel" value="&title;"/>
<label id="dialog.titleLabel" data-l10n-id="print-title"/>
</hbox>
<label id="dialog.title"/>
</row>
<row class="thin-separator">
<row class="thin-separator">
<hbox pack="end">
<label id="dialog.progressSpaces" value="&progress;"/>
<label id="dialog.progressSpaces" data-l10n-id="print-preparing"/>
</hbox>
<label id="dialog.progressLabel" value="&preparing;"/>
<label id="dialog.progressLabel" data-l10n-id="print-progress"/>
</row>
</rows>
</grid>

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

@ -52,14 +52,11 @@ var progressListener = {
if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
// we are done printing
// Indicate completion in title area.
var msg = getString( "printComplete" );
dialog.title.setAttribute("value", msg);
document.l10n.setAttributes(dialog.title, "print-complete");
// Put progress meter at 100%.
dialog.progress.setAttribute( "value", 100 );
var percentPrint = getString( "progressText" );
percentPrint = replaceInsert( percentPrint, 1, 100 );
dialog.progressText.setAttribute("value", percentPrint);
document.l10n.setAttributes(dialog.progressText, "print-percent", {"percent": 100});
if (Services.focus.activeWindow == window) {
// This progress dialog is the currently active window. In
@ -87,10 +84,6 @@ var progressListener = {
dialog.tempLabel.setAttribute("hidden", "true");
dialog.progressBox.removeAttribute("hidden");
var progressLabel = getString("progress");
if (progressLabel == "") {
progressLabel = "Progress:"; // better than nothing
}
switchUI = false;
}
@ -120,9 +113,7 @@ var progressListener = {
dialog.progress.setAttribute( "value", percent );
// Update percentage label on progress meter.
var percentPrint = getString( "progressText" );
percentPrint = replaceInsert( percentPrint, 1, percent );
dialog.progressText.setAttribute("value", percentPrint);
document.l10n.setAttributes(dialog.progressText, "print-percent", {"percent": percent});
} else {
// Progress meter should be barber-pole in this case.
dialog.progress.removeAttribute("value");
@ -152,39 +143,9 @@ var progressListener = {
"nsISupportsWeakReference"]),
};
function getString( stringId ) {
// Check if we've fetched this string already.
if (!(stringId in dialog.strings)) {
// Try to get it.
var elem = document.getElementById( "dialog.strings." + stringId );
try {
if ( elem
&&
elem.childNodes
&&
elem.childNodes[0]
&&
elem.childNodes[0].nodeValue ) {
dialog.strings[stringId] = elem.childNodes[0].nodeValue;
} else {
// If unable to fetch string, use an empty string.
dialog.strings[stringId] = "";
}
} catch (e) { dialog.strings[stringId] = ""; }
}
return dialog.strings[stringId];
}
function loadDialog() {
}
function replaceInsert( text, index, value ) {
var result = text;
var regExp = new RegExp( "#" + index );
result = result.replace( regExp, value );
return result;
}
function onLoad() {
// Set global variables.
printProgress = window.arguments[0];
@ -214,11 +175,7 @@ function onLoad() {
dialog.progressBox.setAttribute("hidden", "true");
var progressLabel = getString("preparing");
if (progressLabel == "") {
progressLabel = "Preparing..."; // better than nothing
}
dialog.tempLabel.value = progressLabel;
document.l10n.setAttributes(dialog.tempLabel, "print-preparing");
dialog.title.value = docTitle;

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

@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version="1.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
@ -6,31 +6,20 @@
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://global/locale/printProgress.dtd">
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
buttons="cancel"
title="&printWindow.title;"
data-l10n-id="print-window"
style="width: 36em;"
ondialogcancel="onCancel()"
onload="onLoad()"
onunload="onUnload()">
<script type="application/javascript" src="chrome://global/content/printProgress.js"/>
<linkset>
<html:link rel="localization" href="toolkit/printing/printDialogs.ftl"/>
</linkset>
<!-- This is non-visible content that simply adds translatable string
into the document so that it is accessible to JS code.
XXX-TODO:
convert to use string bundles.
-->
<data id="dialog.strings.dialogCloseLabel">&dialogClose.label;</data>
<data id="dialog.strings.printComplete">&printComplete;</data>
<data id="dialog.strings.progressText">&percentPrint;</data>
<data id="dialog.strings.progressLabel">&progress;</data>
<data id="dialog.strings.preparing">&preparing;</data>
<script type="application/javascript" src="chrome://global/content/printProgress.js"/>
<grid flex="1">
<columns>
@ -38,20 +27,20 @@
<column/>
<column/>
</columns>
<rows>
<row>
<hbox pack="end">
<label id="dialog.titleLabel" value="&title;"/>
<label id="dialog.titleLabel" data-l10n-id="print-title"/>
</hbox>
<label id="dialog.title"/>
</row>
<row class="thin-separator">
<row class="thin-separator">
<hbox pack="end">
<html:label id="dialog.progressLabel" for="dialog.progress"
style="margin-right: 1em;">&progress;</html:label>
style="margin-right: 1em;" data-l10n-id="progress"></html:label>
</hbox>
<label id="dialog.tempLabel" value="&preparing;"/>
<label id="dialog.tempLabel" data-l10n-id="print-preparing"/>
<vbox pack="center" id="dialog.progressBox">
<html:progress id="dialog.progress" value="0" max="100"></html:progress>
</vbox>

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

@ -1,66 +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/. -->
<!-- extracted from printjoboptions.xul -->
<!ENTITY printSetup.title "Page Setup">
<!ENTITY basic.tab "Format &amp; Options">
<!ENTITY formatGroup.label "Format">
<!ENTITY orientation.label "Orientation:">
<!ENTITY portrait.label "Portrait">
<!ENTITY portrait.accesskey "P">
<!ENTITY landscape.label "Landscape">
<!ENTITY landscape.accesskey "L">
<!ENTITY scale.label "Scale:">
<!ENTITY scale.accesskey "S">
<!ENTITY scalePercent "&#037;">
<!ENTITY shrinkToFit.label "Shrink to fit Page Width">
<!ENTITY shrinkToFit.accesskey "W">
<!ENTITY optionsGroup.label "Options">
<!ENTITY printBG.label "Print Background (colors &amp; images)">
<!ENTITY printBG.accesskey "B">
<!ENTITY advanced.tab "Margins &amp; Header/Footer">
<!ENTITY marginGroup.label "Margins (#1)">
<!ENTITY marginUnits.inches "inches">
<!ENTITY marginUnits.metric "millimeters">
<!ENTITY marginTop.label "Top:">
<!ENTITY marginTop.accesskey "T">
<!ENTITY marginBottom.label "Bottom:">
<!ENTITY marginBottom.accesskey "B">
<!ENTITY marginLeft.label "Left:">
<!ENTITY marginLeft.accesskey "L">
<!ENTITY marginRight.label "Right:">
<!ENTITY marginRight.accesskey "R">
<!ENTITY headerFooter.label "Headers &amp; Footers">
<!ENTITY hfLeft.label "Left:">
<!ENTITY hfCenter.label "Center:">
<!ENTITY hfRight.label "Right:">
<!ENTITY headerLeft.tip "Left header">
<!ENTITY headerCenter.tip "Center header">
<!ENTITY headerRight.tip "Right header">
<!ENTITY footerLeft.tip "Left footer">
<!ENTITY footerCenter.tip "Center footer">
<!ENTITY footerRight.tip "Right footer">
<!ENTITY hfTitle "Title">
<!ENTITY hfURL "URL">
<!ENTITY hfDateAndTime "Date/Time">
<!ENTITY hfPage "Page #">
<!ENTITY hfPageAndTotal "Page # of #">
<!ENTITY hfBlank "--blank--">
<!ENTITY hfCustom "Custom…">
<!ENTITY customPrompt.title "Custom…">
<!ENTITY customPrompt.prompt "Enter your custom header/footer text">

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

@ -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/. -->
<!--LOCALIZATION NOTE printPreviewProgress.dtd Main UI for Print Preview Progress Dialog -->
<!ENTITY printWindow.title "Print Preview">
<!ENTITY title "Title:">
<!ENTITY preparing "Preparing…">
<!ENTITY progress "Progress:">

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

@ -1,21 +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/. -->
<!--LOCALIZATION NOTE printProgress.dtd Main UI for Print Progress Dialog -->
<!ENTITY printWindow.title "Printing">
<!ENTITY title "Title:">
<!ENTITY progress "Progress:">
<!ENTITY preparing "Preparing…">
<!ENTITY printComplete "Printing is Completed.">
<!ENTITY dialogCancel.label "Cancel">
<!ENTITY dialogClose.label "Close">
<!-- LOCALIZATION NOTE (percentPrint):
This string is used to format the text to the right of the progress
meter.
#1 will be replaced by the percentage of the file that has been saved -->
<!ENTITY percentPrint "#1&#037;">

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

@ -0,0 +1,112 @@
# 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/.
print-setup =
.title = Page Setup
custom-prompt-title = Custom…
custom-prompt-prompt = Enter your custom header/footer text
basic-tab =
.label = Format & Options
advanced-tab =
.label = Margins & Header/Footer
format-group-label =
.value = Format
orientation-label =
.value = Orientation:
portrait =
.label = Portrait
.accesskey = P
landscape =
.label = Landscape
.accesskey = L
scale =
.label = Scale:
.accesskey = S
scale-percent =
.value = %
shrink-to-fit =
.label = Shrink to fit Page Width
.accesskey = W
options-group-label =
.value = Options
print-bg =
.label = Print Background (colors & images)
.accesskey = B
margin-group-label-inches =
.value = Margins (inches)
margin-group-label-metric =
.value = Margins (millimeters)
margin-top =
.value = Top:
.accesskey = T
margin-top-invisible =
.value = Top:
margin-bottom =
.value = Bottom:
.accesskey = B
margin-bottom-invisible =
.value = Bottom:
margin-left =
.value = Left:
.accesskey = L
margin-left-invisible =
.value = Left:
margin-right =
.value = Right:
.accesskey = R
margin-right-invisible =
.value = Right:
header-footer-label =
.value = Headers & Footers
hf-left-label =
.value = Left:
hf-center-label =
.value = Center:
hf-right-label =
.value = Right:
header-left-tip =
.tooltiptext = Left header
header-center-tip =
.tooltiptext = Center header
header-right-tip =
.tooltiptext = Right header
footer-left-tip =
.tooltiptext = Left footer
footer-center-tip =
.tooltiptext = Center footer
footer-right-tip =
.tooltiptext = Right footer
hf-blank =
.label = --blank--
hf-title =
.label = Title
hf-url =
.label = URL
hf-date-and-time =
.label = Date/Time
hf-page =
.label = Page #
hf-page-and-total =
.label = Page # of #
hf-custom =
.label = Custom…
print-preview-window =
.title = Print Preview
print-title =
.value = Title:
print-preparing =
.value = Preparing…
print-progress =
.value = Progress:
print-window =
.title = Printing
print-complete =
.value = Printing is Completed.
# Variables
# $percent (integer) - Number of printed percentage
print-percent =
.value = { $percent }%
dialog-cancel-label = Cancel
dialog-close-label = Close

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

@ -43,11 +43,8 @@
#endif
locale/@AB_CD@/global/notification.dtd (%chrome/global/notification.dtd)
#ifndef MOZ_FENNEC
locale/@AB_CD@/global/printPageSetup.dtd (%chrome/global/printPageSetup.dtd)
locale/@AB_CD@/global/printPreview.dtd (%chrome/global/printPreview.dtd)
locale/@AB_CD@/global/printPreviewProgress.dtd (%chrome/global/printPreviewProgress.dtd)
locale/@AB_CD@/global/printdialog.properties (%chrome/global/printdialog.properties)
locale/@AB_CD@/global/printProgress.dtd (%chrome/global/printProgress.dtd)
#endif
locale/@AB_CD@/global/resetProfile.dtd (%chrome/global/resetProfile.dtd)
locale/@AB_CD@/global/resetProfile.properties (%chrome/global/resetProfile.properties)