[tor-commits] [torbutton] branch main updated: Bug 41293: Use the new Fluent API to register Torbutton as a l10n source

gitolite role git at cupani.torproject.org
Fri Nov 4 12:49:53 UTC 2022


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

pierov pushed a commit to branch main
in repository torbutton.

The following commit(s) were added to refs/heads/main by this push:
     new 004b629b Bug 41293: Use the new Fluent API to register Torbutton as a l10n source
004b629b is described below

commit 004b629b21c83133d7c90e0a3656f90d44562746
Author: Pier Angelo Vendrame <pierov at torproject.org>
AuthorDate: Thu Nov 3 17:13:34 2022 +0100

    Bug 41293: Use the new Fluent API to register Torbutton as a l10n source
    
    With Firefox 102, we have switched from a JS implementation of Fluent
    to a Rust one, and the related API has slightly changed.
    
    Anyway. since we are switching to packaged locales, we can register them
    with the jar.mn, rather than using the API.
---
 components/startup-observer.js | 38 --------------------------------------
 jar.mn                         |  1 +
 2 files changed, 1 insertion(+), 38 deletions(-)

diff --git a/components/startup-observer.js b/components/startup-observer.js
index 090eb7b8..8f9b8cc2 100644
--- a/components/startup-observer.js
+++ b/components/startup-observer.js
@@ -28,42 +28,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
   ComponentUtils: "resource://gre/modules/ComponentUtils.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";
 const kMODULE_CONTRACTID = "@torproject.org/startup-observer;1";
@@ -118,8 +82,6 @@ function StartupObserver() {
   }
 
   cleanupCookies();
-
-  registerTranslations();
 }
 
 StartupObserver.prototype = {
diff --git a/jar.mn b/jar.mn
index 8441f006..06caec8f 100644
--- a/jar.mn
+++ b/jar.mn
@@ -23,6 +23,7 @@ torbutton.jar:
 # browser branding
 % override chrome://branding/locale/brand.dtd chrome://torbutton/locale/brand.dtd
 % override chrome://branding/locale/brand.properties chrome://torbutton/locale/brand.properties
+% category l10n-registry torbutton resource://torbutton/locale/{locale}/
 
 # Strings for the about:tbupdate page
 % override chrome://browser/locale/aboutTBUpdate.dtd chrome://torbutton/locale/aboutTBUpdate.dtd

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list