Verified Commit 7d7c220f authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃 Committed by ma1
Browse files

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.
parent 72248ce8
Loading
Loading
Loading
Loading
+8 −15
Original line number Diff line number Diff line
@@ -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(