[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser/tor-browser-78.0.1esr-10.0-1] squash! Bug 4234: Use the Firefox Update Process for Tor Browser.



commit 2fa2abba5ec74a3cfef1a51ef545278248cea4a5
Author: Kathy Brade <brade@xxxxxxxxxxxxxxxxx>
Date:   Tue Jul 28 11:39:29 2020 -0400

    squash! Bug 4234: Use the Firefox Update Process for Tor Browser.
    
    Use a localized string from Torbutton for the app menu's
    "Downloading update" message. This is a temporary fix that can
    be removed once Tor Browser is based on Firefox 79 or newer (at
    which point the localized string will be included in the Firefox
    language packs).
---
 .../customizableui/content/panelUI.inc.xhtml       |  3 +--
 .../components/customizableui/content/panelUI.js   | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/browser/components/customizableui/content/panelUI.inc.xhtml b/browser/components/customizableui/content/panelUI.inc.xhtml
index 5371c4f8b6c0..45f4a10ace7b 100644
--- a/browser/components/customizableui/content/panelUI.inc.xhtml
+++ b/browser/components/customizableui/content/panelUI.inc.xhtml
@@ -224,8 +224,7 @@
       <vbox class="panel-subview-body">
         <vbox id="appMenu-addon-banners"/>
         <toolbarbutton id="appMenu-update-banner" class="panel-banner-item"
-                       data-l10n-id="appmenuitem-update-banner"
-                       data-l10n-attrs="label-update-downloading"
+                       label-update-downloading="Downloading update"
                        label-update-available="&updateAvailable.panelUI.label;"
                        label-update-manual="&updateManual.panelUI.label;"
                        label-update-unsupported="&updateUnsupported.panelUI.label;"
diff --git a/browser/components/customizableui/content/panelUI.js b/browser/components/customizableui/content/panelUI.js
index aa5cc7021f8e..97b6af51b22b 100644
--- a/browser/components/customizableui/content/panelUI.js
+++ b/browser/components/customizableui/content/panelUI.js
@@ -59,6 +59,7 @@ const PanelUI = {
 
   init() {
     this._initElements();
+    this._initUpdaterStrings();
 
     this.menuButton.addEventListener("mousedown", this);
     this.menuButton.addEventListener("keypress", this);
@@ -147,6 +148,27 @@ const PanelUI = {
     }
   },
 
+  _initUpdaterStrings() {
+    // If Torbutton is installed and enabled, replace the "Downloading update"
+    // string with one from torbutton.properties (to facilitate localization).
+    // This function can be removed when Tor Browser is based on Firefox 79
+    // or newer (where the localized string is included in the Firefox
+    // language packs).
+    try {
+      let brands = Services.strings.createBundle(
+                                 "chrome://branding/locale/brand.properties");
+      let stringArgs = [brands.GetStringFromName("brandShortName")];
+      let torbuttonBundle = Services.strings.createBundle(
+                            "chrome://torbutton/locale/torbutton.properties");
+      let label = torbuttonBundle.formatStringFromName(
+                              "updateDownloadingPanelUILabel", stringArgs, 1);
+      let elem = document.getElementById("appMenu-update-banner");
+      if (elem) {
+        elem.setAttribute("label-update-downloading", label);
+      }
+    } catch (e) {}
+  },
+
   _eventListenersAdded: false,
   _ensureEventListenersAdded() {
     if (this._eventListenersAdded) {



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits