Bug 1550131 - Move notification strings to Fluent file. r=MattN,Pike
authorJared Wein <jwein@mozilla.com>
Tue, 21 May 2019 13:16:01 +0000
changeset 474736 4ff5f1d8f9c43dcd1d127554729f4c2c4efd6d9f
parent 474735 1e40a8e7a40409f7098c442b9023be5703d106cd
child 474737 8518f578b1636b86a817ba7307a9ed47c39a6548
push id36046
push useraiakab@mozilla.com
push dateTue, 21 May 2019 21:45:52 +0000
treeherdermozilla-central@257f2c96cef5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN, Pike
bugs1550131
milestone69.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 1550131 - Move notification strings to Fluent file. r=MattN,Pike Differential Revision: https://phabricator.services.mozilla.com/D31747
browser/components/aboutlogins/AboutLoginsParent.jsm
browser/components/aboutlogins/content/aboutLogins.ftl
--- a/browser/components/aboutlogins/AboutLoginsParent.jsm
+++ b/browser/components/aboutlogins/AboutLoginsParent.jsm
@@ -4,16 +4,18 @@
 
 "use strict";
 
 var EXPORTED_SYMBOLS = ["AboutLoginsParent"];
 
 const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.defineModuleGetter(this, "E10SUtils",
                                "resource://gre/modules/E10SUtils.jsm");
+ChromeUtils.defineModuleGetter(this, "Localization",
+                               "resource://gre/modules/Localization.jsm");
 ChromeUtils.defineModuleGetter(this, "LoginHelper",
                                "resource://gre/modules/LoginHelper.jsm");
 ChromeUtils.defineModuleGetter(this, "Services",
                                "resource://gre/modules/Services.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "log", () => {
   return LoginHelper.createLogger("AboutLoginsParent");
 });
@@ -41,16 +43,17 @@ const convertSubjectToLogin = subject =>
     const login = LoginHelper.loginToVanillaObject(subject);
     if (!isValidLogin(login)) {
       return null;
     }
     return login;
 };
 
 var AboutLoginsParent = {
+  _l10n: null,
   _subscribers: new WeakSet(),
 
   // Listeners are added in BrowserGlue.jsm
   receiveMessage(message) {
     // Only respond to messages sent from about:logins.
     if (message.target.remoteType != EXPECTED_ABOUTLOGINS_REMOTE_TYPE ||
         message.target.contentPrincipal.originNoSuffix != ABOUT_LOGINS_ORIGIN) {
       return;
@@ -152,33 +155,37 @@ var AboutLoginsParent = {
         this.messageSubscribers("AboutLogins:LoginRemoved", login);
       }
       default: {
         break;
       }
     }
   },
 
-  showMasterPasswordLoginNotifications() {
-    let messageString = "You must enter your Master Password to view saved logins"; // TODO
+  async showMasterPasswordLoginNotifications() {
+    if (!this._l10n) {
+      this._l10n = new Localization(["browser/aboutLogins.ftl"]);
+    }
+
+    let messageString = await this._l10n.formatValue("master-password-notification-message");
     for (let subscriber of this._subscriberIterator()) {
       // If there's already an existing notification bar, don't do anything.
       let {gBrowser} = subscriber.ownerGlobal;
       let browser = subscriber;
       let notificationBox = gBrowser.getNotificationBox(browser);
       let notification = notificationBox.getNotificationWithValue(MASTER_PASSWORD_NOTIFICATION_ID);
       if (notification) {
         continue;
       }
 
       // Configure the notification bar
       let priority = notificationBox.PRIORITY_WARNING_MEDIUM;
       let iconURL = "chrome://browser/skin/login.svg";
-      let reloadLabel = "Log in"; // TODO
-      let reloadKey   = "L"; // TODO
+      let reloadLabel = await this._l10n.formatValue("master-password-reload-button-label");
+      let reloadKey = await this._l10n.formatValue("master-password-reload-button-accesskey");
 
       let buttons = [{
         label: reloadLabel,
         accessKey: reloadKey,
         popup: null,
         callback() { browser.reload(); },
       }];
 
--- a/browser/components/aboutlogins/content/aboutLogins.ftl
+++ b/browser/components/aboutlogins/content/aboutLogins.ftl
@@ -35,8 +35,14 @@ login-item =
   .copy-username-button = Copy
   .open-site-button = Launch
   .password-label = Password
   .save-changes-button = Save Changes
   .time-created = Created: { DATETIME($timeCreated, day: "numeric", month: "long", year: "numeric") }
   .time-changed = Last changed: { DATETIME($timeChanged, day: "numeric", month: "long", year: "numeric") }
   .time-used = Last used: { DATETIME($timeUsed, day: "numeric", month: "long", year: "numeric") }
   .username-label = Username
+
+master-password-notification-message = Please enter your master password to view saved logins & passwords
+# TODO: Not sure how to use formatValue with these as attributes on a single ID
+master-password-reload-button-label = Log in
+# TODO: Not sure how to use formatValue with these as attributes on a single ID
+master-password-reload-button-accesskey = L