Bug 1369291 - add l10n support for onboarding overlay;r=mossop,Pike,rexboy

MozReview-Commit-ID: 2FICjlfSUet

--HG--
extra : rebase_source : e14efd28f383a57bd21b7de6aaa0ec277cd61978
This commit is contained in:
gasolin 2017-06-02 17:44:56 +08:00
Родитель 02084b0b39
Коммит 40b172ea66
8 изменённых файлов: 38 добавлений и 1 удалений

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

@ -12,6 +12,7 @@ Cu.import("resource://gre/modules/Services.jsm");
const ONBOARDING_CSS_URL = "resource://onboarding/onboarding.css";
const ABOUT_HOME_URL = "about:home";
const ABOUT_NEWTAB_URL = "about:newtab";
const BUNDLE_URI = "chrome://onboarding/locale/onboarding.properties";
/**
* The script won't be initialized if we turned off onboarding by
@ -20,6 +21,7 @@ const ABOUT_NEWTAB_URL = "about:newtab";
class Onboarding {
constructor(contentWindow) {
this.init(contentWindow);
this._bundle = Services.strings.createBundle(BUNDLE_URI);
}
async init(contentWindow) {
@ -62,6 +64,9 @@ class Onboarding {
}
_renderOverlay() {
const BRAND_SHORT_NAME = Services.strings
.createBundle("chrome://branding/locale/brand.properties")
.GetStringFromName("brandShortName");
let div = this._window.document.createElement("div");
div.id = "onboarding-overlay";
// Here we use `innerHTML` is for more friendly reading.
@ -70,7 +75,7 @@ class Onboarding {
div.innerHTML = `
<div id="onboarding-overlay-dialog">
<span id="onboarding-overlay-close-btn"></span>
<header>Getting started?</header>
<header id="onboarding-header"></header>
<nav>
<ul></ul>
</nav>
@ -78,6 +83,9 @@ class Onboarding {
</footer>
</div>
`;
div.querySelector("#onboarding-header").textContent =
this._bundle.formatStringFromName("onboarding.overlay-title", [BRAND_SHORT_NAME], 1);
return div;
}

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

@ -0,0 +1,7 @@
# 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/.
# LOCALIZATION NOTE(onboarding.tour-title): This string will be used in the overlay title
# %S is brandShortName
onboarding.overlay-title=Getting started with %S

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

@ -0,0 +1,8 @@
#filter substitution
# 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/.
[features/onboarding@mozilla.org] @AB_CD@.jar:
% locale onboarding @AB_CD@ %locale/@AB_CD@/
locale/@AB_CD@/onboarding.properties (%onboarding.properties)

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

@ -0,0 +1,7 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
JAR_MANIFESTS += ['jar.mn']

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

@ -7,6 +7,8 @@
DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION']
DIRS += ['locales']
FINAL_TARGET_PP_FILES.features['onboarding@mozilla.org'] += [
'install.rdf.in'
]

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

@ -100,6 +100,9 @@ libs-%:
@$(MAKE) -C ../../extensions/spellcheck/locales AB_CD=$* XPI_NAME=locale-$*
ifndef RELEASE_OR_BETA
@$(MAKE) -C ../extensions/formautofill/locale AB_CD=$* XPI_NAME=locale-$*
endif
ifdef NIGHTLY_BUILD
@$(MAKE) -C ../extensions/onboarding/locales AB_CD=$* XPI_NAME=locale-$*
endif
@$(MAKE) -C ../extensions/pocket/locale AB_CD=$* XPI_NAME=locale-$*
ifndef RELEASE_OR_BETA

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

@ -8,6 +8,7 @@ def test(mod, path, entity = None):
if mod not in ("netwerk", "dom", "toolkit", "security/manager",
"devtools/client", "devtools/shared",
"browser",
"browser/extensions/onboarding",
"browser/extensions/webcompat-reporter",
"extensions/spellcheck",
"other-licenses/branding/firefox",

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

@ -11,6 +11,7 @@ dirs = browser
other-licenses/branding/firefox
browser/branding/official
devtools/client
browser/extensions/onboarding
browser/extensions/webcompat-reporter
[includes]