Bug 1486934 - Modify about:about to use fluent for localization r=Gijs,flod,jaws,Pike
authorQinghao_Jack_Song <songqing@msu.edu>
Wed, 10 Oct 2018 17:41:47 +0000
changeset 496416 ecb1a9d0a887ed363ab4e0199cea4a3e5787e0d3
parent 496415 2bb555faef256f3da3f87c89d3b5d65921447e64
child 496417 ddcd7cc2f3cdd88f5f399f4c59d530aceda0d722
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, flod, jaws, Pike
bugs1486934
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1486934 - Modify about:about to use fluent for localization r=Gijs,flod,jaws,Pike Differential Revision: https://phabricator.services.mozilla.com/D5311
mobile/android/chrome/jar.mn
mobile/android/locales/filter.py
mobile/android/locales/jar.mn
mobile/android/locales/l10n.toml
mobile/locales/filter.py
python/l10n/fluent_migrations/bug_1486934_aboutAbout.py
toolkit/content/aboutAbout.xhtml
toolkit/locales/en-US/chrome/global/aboutAbout.dtd
toolkit/locales/en-US/toolkit/about/aboutAbout.ftl
toolkit/locales/jar.mn
--- a/mobile/android/chrome/jar.mn
+++ b/mobile/android/chrome/jar.mn
@@ -56,17 +56,16 @@ chrome.jar:
 
 % content branding %content/branding/
 
 % override chrome://global/content/config.xul chrome://browser/content/config.xhtml
 % override chrome://global/content/netError.xhtml chrome://browser/content/netError.xhtml
 % override chrome://mozapps/content/extensions/extensions.xul chrome://browser/content/aboutAddons.xhtml
 
 # L10n resource overrides.
-% override chrome://global/locale/aboutAbout.dtd chrome://browser/locale/overrides/aboutAbout.dtd
 % override chrome://global/locale/aboutReader.properties chrome://browser/locale/overrides/aboutReader.properties
 % override chrome://global/locale/aboutRights.dtd chrome://browser/locale/overrides/aboutRights.dtd
 % override chrome://global/locale/charsetMenu.properties chrome://browser/locale/overrides/charsetMenu.properties
 % override chrome://global/locale/commonDialogs.properties chrome://browser/locale/overrides/commonDialogs.properties
 % override chrome://global/locale/intl.properties chrome://browser/locale/overrides/intl.properties
 % override chrome://global/locale/intl.css chrome://browser/locale/overrides/intl.css
 % override chrome://global/locale/search/search.properties chrome://browser/locale/overrides/search/search.properties
 % override chrome://pluginproblem/locale/pluginproblem.dtd chrome://browser/locale/overrides/plugins/pluginproblem.dtd
--- a/mobile/android/locales/filter.py
+++ b/mobile/android/locales/filter.py
@@ -13,17 +13,16 @@ def test(mod, path, entity=None):
     # ignore anything but mobile, which is our local repo checkout name
     if mod not in ("dom", "toolkit", "mobile",
                    "mobile/android/base",  "mobile/android"):
         return "ignore"
 
     if mod == "toolkit":
         # keep this file list in sync with jar.mn
         if path in (
-            "chrome/global/aboutAbout.dtd",
             "chrome/global/aboutReader.properties",
             "chrome/global/aboutRights.dtd",
             "chrome/global/charsetMenu.properties",
             "chrome/global/commonDialogs.properties",
             "chrome/global/intl.properties",
             "chrome/global/intl.css",
             "chrome/search/search.properties",
             "chrome/pluginproblem/pluginproblem.dtd",
@@ -33,16 +32,19 @@ def test(mod, path, entity=None):
             "chrome/global/aboutTelemetry.dtd",
             "chrome/global/aboutTelemetry.properties",
             "chrome/global/aboutWebrtc.properties",
         ):
             return "error"
         if re.match(r"crashreporter/[^/]*.ftl", path):
             # error on crashreporter/*.ftl
             return "error"
+        if re.match(r"toolkit/about/[^/]*About.ftl", path):
+            # error on toolkit/about/*About.ftl
+            return "error"
         return "ignore"
 
     if mod == "dom":
         # keep this file list in sync with jar.mn
         if path in (
             "chrome/global.dtd",
             "chrome/accessibility/AccessFu.properties",
             "chrome/dom/dom.properties",
--- a/mobile/android/locales/jar.mn
+++ b/mobile/android/locales/jar.mn
@@ -32,17 +32,16 @@
   locale/@AB_CD@/browser/passwordmgr.properties   (%chrome/passwordmgr.properties)
 #if MOZ_UPDATE_CHANNEL != release && MOZ_UPDATE_CHANNEL != esr
   locale/@AB_CD@/browser/webcompatReporter.properties (%chrome/webcompatReporter.properties)
 #endif
 
 # 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/aboutAbout.dtd                  (%chrome/global/aboutAbout.dtd)
   locale/@AB_CD@/browser/overrides/aboutReader.properties          (%chrome/global/aboutReader.properties)
   locale/@AB_CD@/browser/overrides/aboutRights.dtd                 (%chrome/global/aboutRights.dtd)
   locale/@AB_CD@/browser/overrides/charsetMenu.properties          (%chrome/global/charsetMenu.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)
   locale/@AB_CD@/browser/overrides/search/search.properties        (%chrome/search/search.properties)
 # plugins
@@ -74,8 +73,10 @@ relativesrcdir dom/locales:
 
 #define EN_US en-US
 #if AB_CD != EN_US
 [localization] @AB_CD@.jar:
 relativesrcdir toolkit/locales:
 #about:crashes
   crashreporter                                    (%crashreporter/**/*.ftl)
 #endif
+#about:about
+  toolkit                                          (%toolkit/about/*About.ftl)
--- a/mobile/android/locales/l10n.toml
+++ b/mobile/android/locales/l10n.toml
@@ -153,16 +153,20 @@ exclude-multi-locale = [
     reference = "dom/locales/en-US/chrome/dom/dom.properties"
     l10n = "{l}dom/chrome/dom/dom.properties"
 
 [[paths]]
     reference = "dom/locales/en-US/chrome/plugins.properties"
     l10n = "{l}dom/chrome/plugins.properties"
 
 [[paths]]
+    reference = "toolkit/locales/en-US/toolkit/about/*About.ftl"
+    l10n = "{l}toolkit/toolkit/about/*About.ftl"
+
+[[paths]]
     reference = "toolkit/locales/en-US/chrome/global/aboutAbout.dtd"
     l10n = "{l}toolkit/chrome/global/aboutAbout.dtd"
 
 [[paths]]
     reference = "toolkit/locales/en-US/chrome/global/aboutReader.properties"
     l10n = "{l}toolkit/chrome/global/aboutReader.properties"
 
 [[paths]]
--- a/mobile/locales/filter.py
+++ b/mobile/locales/filter.py
@@ -13,17 +13,16 @@ def test(mod, path, entity=None):
     # ignore anything but mobile, which is our local repo checkout name
     if mod not in ("dom", "toolkit", "mobile",
                    "mobile/android/base",  "mobile/android"):
         return "ignore"
 
     if mod == "toolkit":
         # keep this file list in sync with jar.mn
         if path in (
-            "chrome/global/aboutAbout.dtd",
             "chrome/global/aboutReader.properties",
             "chrome/global/aboutRights.dtd",
             "chrome/global/charsetMenu.properties",
             "chrome/global/commonDialogs.properties",
             "chrome/global/intl.properties",
             "chrome/global/intl.css",
             "chrome/search/search.properties",
             "chrome/pluginproblem/pluginproblem.dtd",
@@ -33,16 +32,20 @@ def test(mod, path, entity=None):
             "chrome/global/aboutTelemetry.dtd",
             "chrome/global/aboutTelemetry.properties",
             "chrome/global/aboutWebrtc.properties",
         ):
             return "error"
         if re.match(r"crashreporter/[^/]*.ftl", path):
             # error on crashreporter/*.ftl
             return "error"
+
+        if re.match(r"toolkit/about/[^/]*About.ftl", path):
+            # error on toolkit/about/*About.ftl
+            return "error"
         return "ignore"
 
     if mod == "dom":
         # keep this file list in sync with jar.mn
         if path in (
             "chrome/global.dtd",
             "chrome/accessibility/AccessFu.properties",
             "chrome/dom/dom.properties",
new file mode 100644
--- /dev/null
+++ b/python/l10n/fluent_migrations/bug_1486934_aboutAbout.py
@@ -0,0 +1,21 @@
+# 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
+
+def migrate(ctx):
+    """Bug 1486934 - Modify about:about to use fluent for localization, part {index}."""
+
+    ctx.add_transforms(
+        "toolkit/toolkit/about/aboutAbout.ftl",
+        "toolkit/toolkit/about/aboutAbout.ftl",
+        transforms_from(
+"""
+about-about-title = { COPY("toolkit/chrome/global/aboutAbout.dtd", "aboutAbout.title") }
+about-about-note = { COPY("toolkit/chrome/global/aboutAbout.dtd", "aboutAbout.note", trim:"True") }
+""")
+)
--- a/toolkit/content/aboutAbout.xhtml
+++ b/toolkit/content/aboutAbout.xhtml
@@ -1,27 +1,24 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" [
-<!ENTITY % aboutAboutDTD SYSTEM "chrome://global/locale/aboutAbout.dtd" >
-%aboutAboutDTD;
-<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
-%globalDTD;
-]>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 
 <!-- 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/. -->
 
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-  <title>&aboutAbout.title;</title>
+  <title data-l10n-id="about-about-title"></title>
   <link rel="stylesheet" href="chrome://global/skin/in-content/info-pages.css" type="text/css"/>
+  <link rel="localization" href="toolkit/about/aboutAbout.ftl"/>
   <script type="application/javascript" src="chrome://global/content/aboutAbout.js"></script>
+
 </head>
 
-<body dir="&locale.dir;">
+<body>
   <div class="container">
-    <h1>&aboutAbout.title;</h1>
-    <p><em>&aboutAbout.note;</em></p>
+    <h1 data-l10n-id="about-about-title"></h1>
+    <p><em data-l10n-id="about-about-note"></em></p>
     <ul id="abouts" class="columns"></ul>
   </div>
 </body>
 </html>
deleted file mode 100644
--- a/toolkit/locales/en-US/chrome/global/aboutAbout.dtd
+++ /dev/null
@@ -1,8 +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/. -->
-
-<!ENTITY aboutAbout.title  "About About">
-<!ENTITY aboutAbout.note   "This is a list of “about” pages for your convenience.<br/>
-                            Some of them might be confusing. Some are for diagnostic purposes only.<br/>
-                            And some are omitted because they require query strings.">
new file mode 100644
--- /dev/null
+++ b/toolkit/locales/en-US/toolkit/about/aboutAbout.ftl
@@ -0,0 +1,9 @@
+# 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-about-title = About About
+about-about-note =
+    This is a list of “about” pages for your convenience.<br/>
+    Some of them might be confusing. Some are for diagnostic purposes only.<br/>
+    And some are omitted because they require query strings.
--- a/toolkit/locales/jar.mn
+++ b/toolkit/locales/jar.mn
@@ -4,17 +4,16 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 [localization] @AB_CD@.jar:
   crashreporter                                    (%crashreporter/**/*.ftl)
   toolkit                                          (%toolkit/**/*.ftl)
 
 @AB_CD@.jar:
 % locale global @AB_CD@ %locale/@AB_CD@/global/
-  locale/@AB_CD@/global/aboutAbout.dtd                  (%chrome/global/aboutAbout.dtd)
   locale/@AB_CD@/global/aboutReader.properties          (%chrome/global/aboutReader.properties)
   locale/@AB_CD@/global/aboutRights.dtd                 (%chrome/global/aboutRights.dtd)
   locale/@AB_CD@/global/aboutNetworking.dtd             (%chrome/global/aboutNetworking.dtd)
   locale/@AB_CD@/global/aboutStudies.properties         (%chrome/global/aboutStudies.properties)
   locale/@AB_CD@/global/aboutServiceWorkers.dtd         (%chrome/global/aboutServiceWorkers.dtd)
   locale/@AB_CD@/global/aboutServiceWorkers.properties  (%chrome/global/aboutServiceWorkers.properties)
   locale/@AB_CD@/global/aboutSupport.dtd                (%chrome/global/aboutSupport.dtd)
   locale/@AB_CD@/global/aboutSupport.properties         (%chrome/global/aboutSupport.properties)