Bug 1550131 - Move notification strings to Fluent file. r=MattN,Pike
☠☠ backed out by d650f8a160f8 ☠ ☠
authorJared Wein <jwein@mozilla.com>
Mon, 20 May 2019 20:08:10 +0000
changeset 474592 8e7d6a1c30fa282f118b6c8e065c0f2e10fd1f3a
parent 474591 97eabc06294643214ff8d88a432e39c9e2242391
child 474593 95918413069f5ff80feb050f8ef8d45dd8e08b6e
push id36042
push userdvarga@mozilla.com
push dateTue, 21 May 2019 04:19:40 +0000
treeherdermozilla-central@ca560ff55451 [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