Bug 1369291 - add l10n support for onboarding overlay;r=mossop,rexboy
☠☠ backed out by f3e352d6353e ☠ ☠
authorgasolin <gasolin@gmail.com>
Fri, 02 Jun 2017 17:44:56 +0800
changeset 410471 22b83f0ffd516e6c422e19818ca102ead82fde67
parent 410470 4de35d116e5b046104bf7b6f8286eaadf95a4ec2
child 410472 595a075d76deeb98f492d21df178fa545250af40
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop, rexboy
bugs1369291
milestone55.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 1369291 - add l10n support for onboarding overlay;r=mossop,rexboy MozReview-Commit-ID: AzLol5jeAm3
browser/extensions/onboarding/content/onboarding.js
browser/extensions/onboarding/locale/en-US/onboarding.properties
browser/extensions/onboarding/locale/jar.mn
browser/extensions/onboarding/locale/moz.build
browser/extensions/onboarding/moz.build
browser/locales/Makefile.in
--- a/browser/extensions/onboarding/content/onboarding.js
+++ b/browser/extensions/onboarding/content/onboarding.js
@@ -7,24 +7,26 @@
 "use strict";
 
 const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 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
  * setting "browser.onboarding.enabled" to false.
  */
 class Onboarding {
   constructor(contentWindow) {
     this.init(contentWindow);
+    this.bundle = Services.strings.createBundle(BUNDLE_URI);
   }
 
   async init(contentWindow) {
     this._window = contentWindow;
     // We want to create and append elements after CSS is loaded so
     // no flash of style changes and no additional reflow.
     await this._loadCSS();
     this._overlayIcon = this._renderOverlayIcon();
@@ -65,17 +67,17 @@ class Onboarding {
     let div = this._window.document.createElement("div");
     div.id = "onboarding-overlay";
     // Here we use `innerHTML` is for more friendly reading.
     // The security should be fine because this is not from an external input.
     // We're not shipping yet so l10n strings is going to be closed for now.
     div.innerHTML = `
       <div id="onboarding-overlay-dialog">
         <button id="onboarding-tour-close-btn">X</button>
-        <header>Getting started?</header>
+        <header>${this.bundle.GetStringFromName("gettingStarted")}</header>
         <nav>
           <ul></ul>
         </nav>
         <footer>
         </footer>
       </div>
     `;
     return div;
new file mode 100644
--- /dev/null
+++ b/browser/extensions/onboarding/locale/en-US/onboarding.properties
@@ -0,0 +1,5 @@
+# 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/.
+
+gettingStarted=Getting started?
new file mode 100644
--- /dev/null
+++ b/browser/extensions/onboarding/locale/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/.
+
+@AB_CD@.jar:
+% locale onboarding @AB_CD@ %locale/@AB_CD@/
+  locale/@AB_CD@/                (en-US/*)
new file mode 100644
--- /dev/null
+++ b/browser/extensions/onboarding/locale/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']
--- a/browser/extensions/onboarding/moz.build
+++ b/browser/extensions/onboarding/moz.build
@@ -2,16 +2,18 @@
 # 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/.
 
 DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
 DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION']
 
+DIRS += ['locale']
+
 FINAL_TARGET_PP_FILES.features['onboarding@mozilla.org'] += [
   'install.rdf.in'
 ]
 
 FINAL_TARGET_FILES.features['onboarding@mozilla.org'] += [
   'bootstrap.js',
 ]
 
--- a/browser/locales/Makefile.in
+++ b/browser/locales/Makefile.in
@@ -100,16 +100,17 @@ 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
 	@$(MAKE) -C ../extensions/pocket/locale AB_CD=$* XPI_NAME=locale-$*
 ifndef RELEASE_OR_BETA
 	@$(MAKE) -C ../extensions/presentation/locale AB_CD=$* XPI_NAME=locale-$*
 	@$(MAKE) -C ../extensions/webcompat-reporter/locales AB_CD=$* XPI_NAME=locale-$*
+	@$(MAKE) -C ../extensions/onboarding/locale AB_CD=$* XPI_NAME=locale-$*
 endif
 	@$(MAKE) -C ../../intl/locales AB_CD=$* XPI_NAME=locale-$*
 	@$(MAKE) -C ../../devtools/client/locales AB_CD=$* XPI_NAME=locale-$* XPI_ROOT_APPID='$(XPI_ROOT_APPID)'
 	@$(MAKE) -B searchplugins AB_CD=$* XPI_NAME=locale-$*
 	@$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=$(PREF_DIR)
 	@$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$*
 
 repackage-win32-installer: WIN32_INSTALLER_OUT=$(ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe