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
This commit is contained in:
Qinghao_Jack_Song 2018-10-10 17:41:47 +00:00
Родитель 11363a5bd2
Коммит 2d26d932b7
10 изменённых файлов: 50 добавлений и 23 удалений

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

@ -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

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

@ -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":

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

@ -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)

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

@ -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"

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

@ -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":

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

@ -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") }
""")
)

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

@ -1,10 +1,5 @@
<?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
@ -12,15 +7,17 @@
<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>

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

@ -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.">

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

@ -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.

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

@ -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)