From 480921246ac919ac9ff00f95c4cb5ce45808504f Mon Sep 17 00:00:00 2001 From: Jared Wein Date: Mon, 28 Jan 2019 22:31:09 +0000 Subject: [PATCH] Bug 1517508 - Migrate aboutRobots.dtd to Fluent. r=Gijs,flod Differential Revision: https://phabricator.services.mozilla.com/D15661 --HG-- extra : moz-landing-system : lando --- browser/base/content/aboutRobots.xhtml | 33 ++++++++----------- .../general/browser_e10s_switchbrowser.js | 8 ++++- browser/locales/en-US/browser/aboutRobots.ftl | 28 ++++++++++++++++ .../en-US/chrome/browser/aboutRobots.dtd | 29 ---------------- browser/locales/jar.mn | 1 - .../bug_1517508_aboutRobots.py | 30 +++++++++++++++++ 6 files changed, 79 insertions(+), 50 deletions(-) create mode 100644 browser/locales/en-US/browser/aboutRobots.ftl delete mode 100644 browser/locales/en-US/chrome/browser/aboutRobots.dtd create mode 100644 python/l10n/fluent_migrations/bug_1517508_aboutRobots.py diff --git a/browser/base/content/aboutRobots.xhtml b/browser/base/content/aboutRobots.xhtml index 97cc6c2c7118..2bb496d8b253 100644 --- a/browser/base/content/aboutRobots.xhtml +++ b/browser/base/content/aboutRobots.xhtml @@ -9,34 +9,28 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> %htmlDTD; - - %netErrorDTD; - - %globalDTD; - - %aboutrobotsDTD; ]> - &robots.pagetitle; + + + + - +
-

&robots.errorTitleText;

+

@@ -44,29 +38,30 @@
-

&robots.errorShortDescText;

+

    -
  • &robots.errorLongDesc1;
  • -
  • &robots.errorLongDesc2;
  • -
  • &robots.errorLongDesc3;
  • -
  • &robots.errorLongDesc4;
  • +
  • +
  • +
  • +
-

&robots.errorTrailerDescText;

+

+ data-l10n-id="error-try-again" + data-l10n-attrs="label2"> diff --git a/browser/base/content/test/general/browser_e10s_switchbrowser.js b/browser/base/content/test/general/browser_e10s_switchbrowser.js index 777060a8347f..3ddf6974eedb 100644 --- a/browser/base/content/test/general/browser_e10s_switchbrowser.js +++ b/browser/base/content/test/general/browser_e10s_switchbrowser.js @@ -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(); diff --git a/browser/locales/en-US/browser/aboutRobots.ftl b/browser/locales/en-US/browser/aboutRobots.ftl new file mode 100644 index 000000000000..e5932fd2f36f --- /dev/null +++ b/browser/locales/en-US/browser/aboutRobots.ftl @@ -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 wouldn’t believe..." +error-long-desc2 = Robots have seen things you people wouldn’t believe. +# Book: Hitchhiker’s Guide To The Galaxy. What the Sirius Cybernetics Corporation calls robots. +error-long-desc3 = Robots are Your Plastic Pal Who’s 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. diff --git a/browser/locales/en-US/chrome/browser/aboutRobots.dtd b/browser/locales/en-US/chrome/browser/aboutRobots.dtd deleted file mode 100644 index 23447add187b..000000000000 --- a/browser/locales/en-US/chrome/browser/aboutRobots.dtd +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/browser/locales/jar.mn b/browser/locales/jar.mn index c43d6f5fbb9e..9c0172a4dc52 100644 --- a/browser/locales/jar.mn +++ b/browser/locales/jar.mn @@ -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) diff --git a/python/l10n/fluent_migrations/bug_1517508_aboutRobots.py b/python/l10n/fluent_migrations/bug_1517508_aboutRobots.py new file mode 100644 index 000000000000..75a79dc9045d --- /dev/null +++ b/python/l10n/fluent_migrations/bug_1517508_aboutRobots.py @@ -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") } +""") +)