[tbb-commits] [tor-browser] branch tor-browser-102.4.0esr-12.0-2 updated: Bug 41417: Always prompt users to restart after changing language

gitolite role git at cupani.torproject.org
Mon Nov 7 10:46:21 UTC 2022


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

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

The following commit(s) were added to refs/heads/tor-browser-102.4.0esr-12.0-2 by this push:
     new de019e3edec0 Bug 41417: Always prompt users to restart after changing language
de019e3edec0 is described below

commit de019e3edec0f4ead853b5ddb25fd0423d03e916
Author: Pier Angelo Vendrame <pierov at torproject.org>
AuthorDate: Fri Nov 4 14:10:49 2022 +0100

    Bug 41417: Always prompt users to restart after changing language
    
    This is a temporary patch that we need until we switch our strings to
    Fluent. The reason is that we currently set strings when we populate
    our XUL content.
    We could rework the whole mechanism, but it is not worth it because we
    want to switch to Fluent, which will handle everything automatically.
---
 browser/components/preferences/main.js | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js
index eab384264c4e..af53fa0403f7 100644
--- a/browser/components/preferences/main.js
+++ b/browser/components/preferences/main.js
@@ -1202,18 +1202,17 @@ var gMainPane = {
     gMainPane.recordBrowserLanguagesTelemetry("reorder");
 
     switch (gMainPane.getLanguageSwitchTransitionType(newLocales)) {
+      // tor-browser#41417: Always prompt for the restart, until we switch to
+      // Fluent, since the current way we use to update languages does not allow
+      // live-reload. We could also call showConfirmLanguageChangeMessageBar in
+      // the official live-reload case, but the result is inconsistent and makes
+      // handling the locales-match case harder.
       case "requires-restart":
+      case "live-reload":
         // Prepare to change the locales, as they were different.
         gMainPane.showConfirmLanguageChangeMessageBar(newLocales);
         gMainPane.updatePrimaryBrowserLanguageUI(newLocales[0]);
         break;
-      case "live-reload":
-        Services.locale.requestedLocales = newLocales;
-        gMainPane.updatePrimaryBrowserLanguageUI(
-          Services.locale.appLocaleAsBCP47
-        );
-        gMainPane.hideConfirmLanguageChangeMessageBar();
-        break;
       case "locales-match":
         // They matched, so we can reset the UI.
         gMainPane.updatePrimaryBrowserLanguageUI(
@@ -1466,18 +1465,12 @@ var gMainPane = {
     }
 
     switch (gMainPane.getLanguageSwitchTransitionType(selected)) {
+      // tor-browser#41417: see onPrimaryBrowserLanguageMenuChange
       case "requires-restart":
+      case "live-reload":
         gMainPane.showConfirmLanguageChangeMessageBar(selected);
         gMainPane.updatePrimaryBrowserLanguageUI(selected[0]);
         break;
-      case "live-reload":
-        Services.locale.requestedLocales = selected;
-
-        gMainPane.updatePrimaryBrowserLanguageUI(
-          Services.locale.appLocaleAsBCP47
-        );
-        gMainPane.hideConfirmLanguageChangeMessageBar();
-        break;
       case "locales-match":
         // They matched, so we can reset the UI.
         gMainPane.updatePrimaryBrowserLanguageUI(

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


More information about the tbb-commits mailing list