[tbb-commits] [tor-browser] 24/57: Bug 41417: Always prompt users to restart after changing language

gitolite role git at cupani.torproject.org
Mon Dec 5 13:02:00 UTC 2022


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

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

commit af6ad37ee3c7eec2ba9d0eeab22bf5c98b4393e2
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 04ef6e11d5c3..21cbb814b485 100644
--- a/browser/components/preferences/main.js
+++ b/browser/components/preferences/main.js
@@ -1216,18 +1216,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(
@@ -1480,18 +1479,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