diff --git a/browser/extensions/onboarding/content/onboarding.js b/browser/extensions/onboarding/content/onboarding.js index 784348e2f3a9..78d99156c966 100644 --- a/browser/extensions/onboarding/content/onboarding.js +++ b/browser/extensions/onboarding/content/onboarding.js @@ -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 = `
-
Getting started?
+
@@ -78,6 +83,9 @@ class Onboarding {
`; + + div.querySelector("#onboarding-header").textContent = + this._bundle.formatStringFromName("onboarding.overlay-title", [BRAND_SHORT_NAME], 1); return div; } diff --git a/browser/extensions/onboarding/locales/en-US/onboarding.properties b/browser/extensions/onboarding/locales/en-US/onboarding.properties new file mode 100644 index 000000000000..d62a41056e6e --- /dev/null +++ b/browser/extensions/onboarding/locales/en-US/onboarding.properties @@ -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 diff --git a/browser/extensions/onboarding/locales/jar.mn b/browser/extensions/onboarding/locales/jar.mn new file mode 100644 index 000000000000..0801f8512775 --- /dev/null +++ b/browser/extensions/onboarding/locales/jar.mn @@ -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) diff --git a/browser/extensions/onboarding/locales/moz.build b/browser/extensions/onboarding/locales/moz.build new file mode 100644 index 000000000000..aac3a838c4c2 --- /dev/null +++ b/browser/extensions/onboarding/locales/moz.build @@ -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'] diff --git a/browser/extensions/onboarding/moz.build b/browser/extensions/onboarding/moz.build index 8c008f852ca2..6f9b6402b350 100644 --- a/browser/extensions/onboarding/moz.build +++ b/browser/extensions/onboarding/moz.build @@ -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' ] diff --git a/browser/locales/Makefile.in b/browser/locales/Makefile.in index 4bb0ece39f6c..83a6d1aa9cc1 100644 --- a/browser/locales/Makefile.in +++ b/browser/locales/Makefile.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 diff --git a/browser/locales/filter.py b/browser/locales/filter.py index 25c6b84e489c..2fa60c992c6b 100755 --- a/browser/locales/filter.py +++ b/browser/locales/filter.py @@ -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", diff --git a/browser/locales/l10n.ini b/browser/locales/l10n.ini index dee7762bcd70..d0f1d011d801 100644 --- a/browser/locales/l10n.ini +++ b/browser/locales/l10n.ini @@ -11,6 +11,7 @@ dirs = browser other-licenses/branding/firefox browser/branding/official devtools/client + browser/extensions/onboarding browser/extensions/webcompat-reporter [includes]