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

[tor-commits] [torbutton] 01/02: Bug 40730: Do not register localizations in 102



This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch main
in repository torbutton.

commit 12c59736333027b44e28b0f04f0000eaa6741598
Author: Pier Angelo Vendrame <pierov@xxxxxxxxxxxxxx>
AuthorDate: Wed Aug 24 15:57:20 2022 +0200

    Bug 40730: Do not register localizations in 102
---
 components/startup-observer.js | 69 ++++++++++++++++++++++++------------------
 1 file changed, 39 insertions(+), 30 deletions(-)

diff --git a/components/startup-observer.js b/components/startup-observer.js
index 77df172a..f89bbe08 100644
--- a/components/startup-observer.js
+++ b/components/startup-observer.js
@@ -12,6 +12,9 @@
  *
  *************************************************************************/
 
+const { AppConstants } = ChromeUtils.import(
+  "resource://gre/modules/AppConstants.jsm"
+);
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 const { XPCOMUtils } = ChromeUtils.import(
   "resource://gre/modules/XPCOMUtils.jsm"
@@ -21,11 +24,41 @@ XPCOMUtils.defineLazyModuleGetters(this, {
   ComponentUtils: "resource://gre/modules/ComponentUtils.jsm",
 });
 
-XPCOMUtils.defineLazyModuleGetters(this, {
-  FileUtils: "resource://gre/modules/FileUtils.jsm",
-  FileSource: "resource://gre/modules/L10nRegistry.jsm",
-  L10nRegistry: "resource://gre/modules/L10nRegistry.jsm",
-});
+let registerTranslations = () => {};
+if (parseInt(AppConstants.TOR_BROWSER_VERSION) < 102) {
+  XPCOMUtils.defineLazyModuleGetters(this, {
+    FileUtils: "resource://gre/modules/FileUtils.jsm",
+    FileSource: "resource://gre/modules/L10nRegistry.jsm",
+    L10nRegistry: "resource://gre/modules/L10nRegistry.jsm",
+  });
+  registerTranslations = () => {
+    // Using all possible locales so that we do not have to change this list every time we support
+    // a new one.
+    /* eslint-disable */
+    const allLocales = [
+      "en-US", "ach", "af", "an", "ar", "ast", "az", "be", "bg", "bn", "br", "bs", "ca", "cak",
+      "crh", "cs", "cy", "da", "de", "dsb", "el", "en-CA", "en-GB", "eo", "es-AR", "es-CL",
+      "es-ES", "es-MX", "et", "eu", "fa", "ff", "fi", "fr", "fy-NL", "ga-IE", "gd", "gl", "gn",
+      "gu-IN", "he", "hi-IN", "hr", "hsb", "hu", "hy-AM", "ia", "id", "is", "it", "ja",
+      "ja-JP-mac", "ka", "kab", "kk", "km", "kn", "ko", "lij", "lo", "lt", "ltg", "lv", "mk", "mr",
+      "ms", "my", "nb-NO", "ne-NP", "nl", "nn-NO", "oc", "pa-IN", "pl", "pt-BR", "pt-PT", "rm",
+      "ro", "ru", "si", "sk", "sl", "son", "sq", "sr", "sv-SE", "ta", "te", "th", "tl", "tr",
+      "trs", "uk", "ur", "uz", "vi", "wo", "xh", "zh-CN", "zh-TW"
+    ];
+    /* eslint-enable */
+    let torSource = new FileSource(
+      "torbutton",
+      allLocales,
+      "resource://torbutton/locale/{locale}/",
+      true // skip this FileSource locales when computing Services.locale.availableLocales
+    );
+    if (L10nRegistry.registerSources) {
+      L10nRegistry.registerSources([torSource]);
+    } else {
+      L10nRegistry.registerSource(torSource);
+    }
+  };
+}
 
 // Module specific constants
 const kMODULE_NAME = "Startup";
@@ -82,31 +115,7 @@ function StartupObserver() {
 
   cleanupCookies();
 
-  // Using all possible locales so that we do not have to change this list every time we support
-  // a new one.
-  /* eslint-disable */
-  const allLocales = [
-    "en-US", "ach", "af", "an", "ar", "ast", "az", "be", "bg", "bn", "br", "bs", "ca", "cak",
-    "crh", "cs", "cy", "da", "de", "dsb", "el", "en-CA", "en-GB", "eo", "es-AR", "es-CL",
-    "es-ES", "es-MX", "et", "eu", "fa", "ff", "fi", "fr", "fy-NL", "ga-IE", "gd", "gl", "gn",
-    "gu-IN", "he", "hi-IN", "hr", "hsb", "hu", "hy-AM", "ia", "id", "is", "it", "ja",
-    "ja-JP-mac", "ka", "kab", "kk", "km", "kn", "ko", "lij", "lo", "lt", "ltg", "lv", "mk", "mr",
-    "ms", "my", "nb-NO", "ne-NP", "nl", "nn-NO", "oc", "pa-IN", "pl", "pt-BR", "pt-PT", "rm",
-    "ro", "ru", "si", "sk", "sl", "son", "sq", "sr", "sv-SE", "ta", "te", "th", "tl", "tr",
-    "trs", "uk", "ur", "uz", "vi", "wo", "xh", "zh-CN", "zh-TW"
-  ];
-  /* eslint-enable */
-  let torSource = new FileSource(
-    "torbutton",
-    allLocales,
-    "resource://torbutton/locale/{locale}/",
-    true // skip this FileSource locales when computing Services.locale.availableLocales
-  );
-  if (L10nRegistry.registerSources) {
-    L10nRegistry.registerSources([torSource]);
-  } else {
-    L10nRegistry.registerSource(torSource);
-  }
+  registerTranslations();
 }
 
 StartupObserver.prototype = {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits