Bug 1629360 - Async translations in mailWidgets and specialTabs. r=mkmelin
authorLasana Murray <lasana@thunderbird.net>
Thu, 04 Jun 2020 16:12:01 -0400
changeset 29949 e3814792ce88e4086ef3e1d93a35539a84f439b4
parent 29948 61b41f6239dc3e92b0439c53331e7eab4438f42a
child 29950 42e64a1bc4481d7f717272546359c3026cae6673
push id17613
push usergeoff@darktrojan.net
push dateTue, 23 Jun 2020 22:34:33 +0000
treeherdercomm-central@9cfb71b9e9f9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1629360
Bug 1629360 - Async translations in mailWidgets and specialTabs. r=mkmelin
mail/base/content/mailWidgets.js
mail/base/content/specialTabs.js
--- a/mail/base/content/mailWidgets.js
+++ b/mail/base/content/mailWidgets.js
@@ -29,20 +29,16 @@
   const { DBViewWrapper } = ChromeUtils.import(
     "resource:///modules/DBViewWrapper.jsm"
   );
   const { TagUtils } = ChromeUtils.import("resource:///modules/TagUtils.jsm");
   var { MimeParser } = ChromeUtils.import("resource:///modules/mimeParser.jsm");
   var { DisplayNameUtils } = ChromeUtils.import(
     "resource:///modules/DisplayNameUtils.jsm"
   );
-  var l10n = new Localization(
-    ["messenger/messengercompose/messengercompose.ftl"],
-    true
-  );
 
   class MozMailHeaderfield extends MozXULElement {
     connectedCallback() {
       this.setAttribute("context", "copyPopup");
       this.classList.add("headerValue");
 
       this._ariaBaseLabel = null;
       if (this.getAttribute("aria-labelledby")) {
@@ -2169,20 +2165,20 @@
       row.setAttribute("data-labelid", recipient.labelId);
 
       let firstCol = document.createXULElement("hbox");
       firstCol.classList.add("aw-firstColBox");
 
       row.classList.add("hidden");
 
       let closeLabel = document.createXULElement("label");
-      let tooltip = l10n.formatValueSync("remove-address-row-type", {
+      document.l10n.setAttributes(closeLabel, "remove-address-row-type-label", {
         type: recipient.labelId,
       });
-      closeLabel.setAttribute("tooltiptext", tooltip);
+
       closeLabel.addEventListener("click", event => {
         closeLabelOnClick(event);
       });
       closeLabel.addEventListener("keypress", event => {
         closeLabelOnKeyPress(event);
       });
       closeLabel.setAttribute("role", "button");
       // Necessary to allow focus via TAB key.
--- a/mail/base/content/specialTabs.js
+++ b/mail/base/content/specialTabs.js
@@ -398,23 +398,20 @@ var contentTabBaseType = {
 
     // Let's not mess with about:blank.
     null,
 
     // about:profiles
     function(aDocument, aTab) {
       // Need a timeout to let the script run to create the needed buttons.
       setTimeout(() => {
-        let l10n = new Localization(["messenger/aboutProfilesExtra.ftl"], true);
         for (let button of aDocument.querySelectorAll(
           `[data-l10n-id="profiles-launch-profile"]`
         )) {
-          button.textContent = l10n.formatValueSync(
-            "profiles-launch-profile-plain"
-          );
+          document.l10n.setAttributes(button, "profiles-launch-profile-plain");
         }
       }, 500);
     },
 
     // about:certificate
     function(aDocument, aTab) {
       // Need a timeout to let the script run to create the needed links.
       setTimeout(() => {