From 2d26d932b7035841d9a6b71ae34452842f9ab9d3 Mon Sep 17 00:00:00 2001 From: Qinghao_Jack_Song Date: Wed, 10 Oct 2018 17:41:47 +0000 Subject: [PATCH] Bug 1486934 - Modify about:about to use fluent for localization r=Gijs,flod,jaws,Pike Differential Revision: https://phabricator.services.mozilla.com/D5311 --HG-- extra : moz-landing-system : lando --- mobile/android/chrome/jar.mn | 1 - mobile/android/locales/filter.py | 4 +++- mobile/android/locales/jar.mn | 3 ++- mobile/android/locales/l10n.toml | 4 ++++ mobile/locales/filter.py | 5 ++++- .../bug_1486934_aboutAbout.py | 21 +++++++++++++++++++ toolkit/content/aboutAbout.xhtml | 17 +++++++-------- .../en-US/chrome/global/aboutAbout.dtd | 8 ------- .../en-US/toolkit/about/aboutAbout.ftl | 9 ++++++++ toolkit/locales/jar.mn | 1 - 10 files changed, 50 insertions(+), 23 deletions(-) create mode 100644 python/l10n/fluent_migrations/bug_1486934_aboutAbout.py delete mode 100644 toolkit/locales/en-US/chrome/global/aboutAbout.dtd create mode 100644 toolkit/locales/en-US/toolkit/about/aboutAbout.ftl diff --git a/mobile/android/chrome/jar.mn b/mobile/android/chrome/jar.mn index fff177379755..a94ff7c51c05 100644 --- a/mobile/android/chrome/jar.mn +++ b/mobile/android/chrome/jar.mn @@ -61,7 +61,6 @@ chrome.jar: % 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 diff --git a/mobile/android/locales/filter.py b/mobile/android/locales/filter.py index c41c5f525f13..2de041be081b 100644 --- a/mobile/android/locales/filter.py +++ b/mobile/android/locales/filter.py @@ -18,7 +18,6 @@ def test(mod, path, entity=None): 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", @@ -38,6 +37,9 @@ def test(mod, path, entity=None): 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": diff --git a/mobile/android/locales/jar.mn b/mobile/android/locales/jar.mn index f2b20d033cbe..620cc6ba01e0 100644 --- a/mobile/android/locales/jar.mn +++ b/mobile/android/locales/jar.mn @@ -37,7 +37,6 @@ # 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) @@ -79,3 +78,5 @@ relativesrcdir toolkit/locales: #about:crashes crashreporter (%crashreporter/**/*.ftl) #endif +#about:about + toolkit (%toolkit/about/*About.ftl) diff --git a/mobile/android/locales/l10n.toml b/mobile/android/locales/l10n.toml index 351a223d22f2..56ce0d8e73b9 100644 --- a/mobile/android/locales/l10n.toml +++ b/mobile/android/locales/l10n.toml @@ -157,6 +157,10 @@ exclude-multi-locale = [ 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" diff --git a/mobile/locales/filter.py b/mobile/locales/filter.py index 82d7e1b4caad..24b0f7c94f0b 100644 --- a/mobile/locales/filter.py +++ b/mobile/locales/filter.py @@ -18,7 +18,6 @@ def test(mod, path, entity=None): 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", @@ -38,6 +37,10 @@ def test(mod, path, entity=None): 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": diff --git a/python/l10n/fluent_migrations/bug_1486934_aboutAbout.py b/python/l10n/fluent_migrations/bug_1486934_aboutAbout.py new file mode 100644 index 000000000000..8422e314326b --- /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") } +""") +) diff --git a/toolkit/content/aboutAbout.xhtml b/toolkit/content/aboutAbout.xhtml index b3d67bea24a8..c631272f928b 100644 --- a/toolkit/content/aboutAbout.xhtml +++ b/toolkit/content/aboutAbout.xhtml @@ -1,10 +1,5 @@ - -%aboutAboutDTD; - -%globalDTD; -]> + - - - - Some of them might be confusing. Some are for diagnostic purposes only.
- And some are omitted because they require query strings."> diff --git a/toolkit/locales/en-US/toolkit/about/aboutAbout.ftl b/toolkit/locales/en-US/toolkit/about/aboutAbout.ftl new file mode 100644 index 000000000000..ce2a311736db --- /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.
+ Some of them might be confusing. Some are for diagnostic purposes only.
+ And some are omitted because they require query strings. diff --git a/toolkit/locales/jar.mn b/toolkit/locales/jar.mn index 268a086bb662..9702274f0c4e 100644 --- a/toolkit/locales/jar.mn +++ b/toolkit/locales/jar.mn @@ -9,7 +9,6 @@ @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)