Bug 1369291 - add l10n support for onboarding overlay;r=mossop,rexboy
☠☠ backed out by 869ba165ad1e ☠ ☠
authorgasolin <gasolin@gmail.com>
Fri, 02 Jun 2017 17:44:56 +0800
changeset 410350 6b6a52c561b2ad47a53a3fb82c85e087d72bdd99
parent 410349 50e5014bb919148b2422034a9788af9d72c91e26
child 410351 869ba165ad1e01626267f4ca8fb5b46a2d66e0a3
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: 5awTvl1jJcH
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
--- 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',
 ]