[tbb-commits] [tor-browser] 40/74: Bug 41369: Improve Firefox language settings for multi-lingual packages

gitolite role git at cupani.torproject.org
Thu Oct 27 21:21:45 UTC 2022


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

richard pushed a commit to branch tor-browser-102.4.0esr-12.0-2
in repository tor-browser.

commit efc94975389401d55f93c5f04afb77479432307e
Author: Pier Angelo Vendrame <pierov at torproject.org>
AuthorDate: Tue Oct 18 19:02:18 2022 +0200

    Bug 41369: Improve Firefox language settings for multi-lingual packages
    
    Change the language selector to be sorted by language code, rather than
    name, and to display the language code to the user.
    
    Bug 41372: Handle Japanese as a special case in preferences on macOS
    
    Japanese is treated in a special way on macOS. However, seeing the
    Japanese language tag could be confusing for users, and moreover the
    language name is not localized correctly like other langs.
---
 browser/components/preferences/main.js | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js
index f0864a5cfff4..42cc72f6f91c 100644
--- a/browser/components/preferences/main.js
+++ b/browser/components/preferences/main.js
@@ -1027,8 +1027,28 @@ var gMainPane = {
       available,
       { preferNative: true }
     );
-    let locales = available.map((code, i) => ({ code, name: localeNames[i] }));
-    locales.sort((a, b) => a.name > b.name);
+    let locales = available.map((code, i) => {
+      let name = localeNames[i].replace(/\s*\(.+\)$/g, "");
+      if (code === "ja-JP-macos") {
+        // Mozilla codebases handle Japanese in macOS in different ways,
+        // sometimes they call it ja-JP-mac and sometimes they call it
+        // ja-JP-macos. The former is translated to Japanese when specifying
+        // preferNative to true, the latter is not. Since seeing ja-JP-macos
+        // would be confusing anyway, we treat it as a special case.
+        // See tor-browser#41372 and Bug 1726586.
+        name =
+          Services.intl.getLocaleDisplayNames(undefined, ["ja"], {
+            preferNative: true,
+          }) + " (ja)";
+      } else {
+        name += ` (${code})`;
+      }
+      return {
+        code,
+        name,
+      };
+    });
+    locales.sort((a, b) => a.code.localeCompare(b.code));
 
     let fragment = document.createDocumentFragment();
     for (let { code, name } of locales) {

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


More information about the tbb-commits mailing list