Bug 1517508 - Migrate aboutRobots.dtd to Fluent. r=Gijs,flod

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jared Wein 2019-01-28 22:31:09 +00:00
Родитель 608a89c9c8
Коммит 480921246a
6 изменённых файлов: 79 добавлений и 50 удалений

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

@ -9,34 +9,28 @@
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
%htmlDTD;
<!ENTITY % netErrorDTD
SYSTEM "chrome://global/locale/netError.dtd">
%netErrorDTD;
<!ENTITY % globalDTD
SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
<!ENTITY % aboutrobotsDTD
SYSTEM "chrome://browser/locale/aboutRobots.dtd">
%aboutrobotsDTD;
]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Security-Policy" content="default-src chrome:" />
<title>&robots.pagetitle;</title>
<title data-l10n-id="page-title"></title>
<link rel="stylesheet" href="chrome://global/skin/netError.css" type="text/css" media="all" />
<link rel="icon" type="image/png" id="favicon" href="chrome://browser/content/robot.ico"/>
<link rel="stylesheet" href="chrome://browser/content/aboutRobots.css" type="text/css"/>
<linkset>
<link rel="localization" href="browser/aboutRobots.ftl"/>
</linkset>
</head>
<body dir="&locale.dir;">
<body>
<!-- PAGE CONTAINER (for styling purposes only) -->
<div id="errorPageContainer">
<!-- Error Title -->
<div id="errorTitle">
<h1 id="errorTitleText">&robots.errorTitleText;</h1>
<h1 id="errorTitleText" data-l10n-id="error-title-text"></h1>
</div>
<!-- LONG CONTENT (the section most likely to require scrolling) -->
@ -44,29 +38,30 @@
<!-- Short Description -->
<div id="errorShortDesc">
<p id="errorShortDescText">&robots.errorShortDescText;</p>
<p id="errorShortDescText" data-l10n-id="error-short-desc-text"></p>
</div>
<!-- Long Description (Note: See netError.dtd for used XHTML tags) -->
<div id="errorLongDesc">
<ul>
<li>&robots.errorLongDesc1;</li>
<li>&robots.errorLongDesc2;</li>
<li>&robots.errorLongDesc3;</li>
<li>&robots.errorLongDesc4;</li>
<li data-l10n-id="error-long-desc1"></li>
<li data-l10n-id="error-long-desc2"></li>
<li data-l10n-id="error-long-desc3"></li>
<li data-l10n-id="error-long-desc4"></li>
</ul>
</div>
<!-- Short Description -->
<div id="errorTrailerDesc">
<p id="errorTrailerDescText">&robots.errorTrailerDescText;</p>
<p id="errorTrailerDescText" data-l10n-id="error-trailer-desc-text"></p>
</div>
</div>
<!-- Button -->
<button id="errorTryAgain"
label2="&robots.dontpress;">&retry.label;</button>
data-l10n-id="error-try-again"
data-l10n-attrs="label2"></button>
<img id="widget1" src="chrome://browser/content/aboutRobots-widget-left.png"/>
<img id="widget2" src="chrome://browser/content/aboutRobots-widget-left.png"/>

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

@ -48,7 +48,7 @@ var check_history = async function() {
for (let i = 0; i < count; i++) {
let entry = sessionHistory.entries[i];
info("Checking History Entry:", entry.uri);
info("Checking History Entry: " + entry.uri);
is(entry.uri, gExpectedHistory.entries[i].uri, "Should have the right URI");
is(entry.title, gExpectedHistory.entries[i].title, "Should have the right title");
}
@ -137,6 +137,8 @@ add_task(async function test_navigation() {
info("3");
// Load a non-remote page
await waitForLoad("about:robots");
await TestUtils.waitForCondition(() => gBrowser.selectedBrowser.contentTitle != "about:robots",
"Waiting for about:robots title to update");
is(gBrowser.selectedBrowser.isRemoteBrowser, false, "Remote attribute should be correct");
is(gBrowser.selectedBrowser.permanentKey, permanentKey, "browser.permanentKey is still the same");
await check_history();
@ -240,6 +242,8 @@ add_task(async function test_loadflags() {
// Create a tab and load a remote page in it
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:blank", {skipAnimation: true});
await waitForLoadWithFlags("about:robots");
await TestUtils.waitForCondition(() => gBrowser.selectedBrowser.contentTitle != "about:robots",
"Waiting for about:robots title to update");
is(gBrowser.selectedBrowser.isRemoteBrowser, false, "Remote attribute should be correct");
await check_history();
@ -252,6 +256,8 @@ add_task(async function test_loadflags() {
info("3");
// Load a non-remote page
await waitForLoadWithFlags("about:robots");
await TestUtils.waitForCondition(() => gBrowser.selectedBrowser.contentTitle != "about:robots",
"Waiting for about:robots title to update");
is(gBrowser.selectedBrowser.isRemoteBrowser, false, "Remote attribute should be correct");
await check_history();

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

@ -0,0 +1,28 @@
# 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/.
### These strings are used in the about:robots page, which ties in with the
### robots theme used in the Firefox 3 Beta 2/3 first run pages.
### They're just meant to be fun and whimsical, with references to some geeky
### but well-known robots in movies and books. Be creative with translations!
# Nonsense line from the movie "The Day The Earth Stood Still". No translation needed.
page-title = Gort! Klaatu barada nikto!
# Movie: Logan's Run... Box (cyborg): "Welcome Humans! I am ready for you."
error-title-text = Welcome Humans!
# Movie: The Day The Earth Stood Still. Spoken by Klaatu.
error-short-desc-text = We have come to visit you in peace and with goodwill!
# Various books by Isaac Asimov. http://en.wikipedia.org/wiki/Three_Laws_of_Robotics
error-long-desc1 = Robots may not injure a human being or, through inaction, allow a human being to come to harm.
# Movie: Blade Runner. Batty: "I've seen things you people wouldnt believe..."
error-long-desc2 = Robots have seen things you people wouldnt believe.
# Book: Hitchhikers Guide To The Galaxy. What the Sirius Cybernetics Corporation calls robots.
error-long-desc3 = Robots are Your Plastic Pal Whos Fun To Be With.
# TV: Futurama. Bender's first line is "Bite my shiny metal ass."
error-long-desc4 = Robots have shiny metal posteriors which should not be bitten.
# TV: Battlestar Galactica (2004 series). From the opening text.
error-trailer-desc-text = And they have a plan.
# Book: Hitchhiker's Guide To The Galaxy. Arthur presses a button and it warns him.
error-try-again = Try Again
.label2 = Please do not press this button again.

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

@ -1,29 +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/. -->
<!-- These strings are used in the about:robots page, which ties in with the
robots theme used in the Firefox 3 Beta 2/3 first run pages.
They're just meant to be fun and whimsical, with references to some geeky
but well-known robots in movies and books. Be creative with translations! -->
<!-- Nonsense line from the movie "The Day The Earth Stood Still". No translation needed. -->
<!ENTITY robots.pagetitle "Gort! Klaatu barada nikto!">
<!-- Movie: Logan's Run... Box (cybog): "Welcome Humans! I am ready for you." -->
<!ENTITY robots.errorTitleText "Welcome Humans!">
<!-- Movie: The Day The Earth Stood Still. Spoken by Klaatu. -->
<!ENTITY robots.errorShortDescText "We have come to visit you in peace and with goodwill!">
<!-- Various books by Isaac Asimov. http://en.wikipedia.org/wiki/Three_Laws_of_Robotics -->
<!ENTITY robots.errorLongDesc1 "Robots may not injure a human being or, through inaction, allow a human being to come to harm.">
<!-- Movie: Blade Runner. Batty: "I've seen things you people wouldnt believe..." -->
<!ENTITY robots.errorLongDesc2 "Robots have seen things you people wouldnt believe.">
<!-- Book: Hitchhikers Guide To The Galaxy. What the Sirius Cybernetics Corporation calls robots. -->
<!ENTITY robots.errorLongDesc3 "Robots are Your Plastic Pal Whos Fun To Be With.">
<!-- TV: Futurama. Bender's first line is "Bite my shiny metal ass." -->
<!ENTITY robots.errorLongDesc4 "Robots have shiny metal posteriors which should not be bitten.">
<!-- TV: Battlestar Galactica (2004 series). From the opening text. -->
<!ENTITY robots.errorTrailerDescText "And they have a plan.">
<!-- TV: Battlestar Galactica (2004 series). Common expletive referring to Cylons. -->
<!ENTITY robots.imgtitle "Frakkin' Toasters">
<!-- Book: Hitchhiker's Guide To The Galaxy. Arthur presses a button and it warns him. -->
<!ENTITY robots.dontpress "Please do not press this button again.">

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

@ -15,7 +15,6 @@
# bookmarks.html is produced by LOCALIZED_GENERATED_FILES.
locale/browser/bookmarks.html (bookmarks.html)
locale/browser/aboutPrivateBrowsing.dtd (%chrome/browser/aboutPrivateBrowsing.dtd)
locale/browser/aboutRobots.dtd (%chrome/browser/aboutRobots.dtd)
locale/browser/accounts.properties (%chrome/browser/accounts.properties)
locale/browser/aboutTabCrashed.dtd (%chrome/browser/aboutTabCrashed.dtd)
locale/browser/browser.dtd (%chrome/browser/browser.dtd)

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

@ -0,0 +1,30 @@
# 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 import COPY
def migrate(ctx):
"""Bug 1517508 - Migrate about:robots to use Fluent for localization, part {index}."""
ctx.add_transforms(
"browser/browser/aboutRobots.ftl",
"browser/browser/aboutRobots.ftl",
transforms_from(
"""
page-title = { COPY("browser/chrome/browser/aboutRobots.dtd", "robots.pagetitle") }
error-title-text = { COPY("browser/chrome/browser/aboutRobots.dtd", "robots.errorTitleText") }
error-short-desc-text = { COPY("browser/chrome/browser/aboutRobots.dtd", "robots.errorShortDescText") }
error-long-desc1 = { COPY("browser/chrome/browser/aboutRobots.dtd", "robots.errorLongDesc1") }
error-long-desc2 = { COPY("browser/chrome/browser/aboutRobots.dtd", "robots.errorLongDesc2") }
error-long-desc3 = { COPY("browser/chrome/browser/aboutRobots.dtd", "robots.errorLongDesc3") }
error-long-desc4 = { COPY("browser/chrome/browser/aboutRobots.dtd", "robots.errorLongDesc4") }
error-trailer-desc-text = { COPY("browser/chrome/browser/aboutRobots.dtd", "robots.errorTrailerDescText") }
error-try-again = { COPY("browser/chrome/overrides/netError.dtd", "retry.label") }
.label2 = { COPY("browser/chrome/browser/aboutRobots.dtd", "robots.dontpress") }
""")
)