Bug 1575512 - Follow-up: Re-initialise folder names on intl:app-locales-changed. r=aceman a=jorgk
authorJorg K <jorgk@jorgk.com>
Fri, 25 Oct 2019 19:43:53 +0200
changeset 37222 5da939a404338d73dd43e51cb5d360cdceabc8f6
parent 37221 72e31dc3fced0d01710fc25185a7064df7c95b7c
child 37223 18b62ac23e0da4c2b5e464d883507930105687da
push id395
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:38:57 +0000
reviewersaceman, jorgk
bugs1575512
Bug 1575512 - Follow-up: Re-initialise folder names on intl:app-locales-changed. r=aceman a=jorgk
mail/components/mailGlue.js
--- a/mail/components/mailGlue.js
+++ b/mail/components/mailGlue.js
@@ -72,16 +72,17 @@ function MailGlue() {
   this._init();
 }
 
 MailGlue.prototype = {
   // init (called at app startup)
   _init() {
     Services.obs.addObserver(this, "xpcom-shutdown");
     Services.obs.addObserver(this, "final-ui-startup");
+    Services.obs.addObserver(this, "intl:app-locales-changed");
     Services.obs.addObserver(this, "mail-startup-done");
     Services.obs.addObserver(this, "handle-xul-text-link");
     Services.obs.addObserver(this, "chrome-document-global-created");
 
     // Inject scripts into some devtools windows.
     function _setupBrowserConsole(domWindow) {
       // Browser Console is an XHTML document.
       domWindow.document.title = gMailBundle.GetStringFromName(
@@ -119,34 +120,42 @@ MailGlue.prototype = {
     ActorManagerParent.addActors(ACTORS);
     ActorManagerParent.flush();
   },
 
   // cleanup (called at shutdown)
   _dispose() {
     Services.obs.removeObserver(this, "xpcom-shutdown");
     Services.obs.removeObserver(this, "final-ui-startup");
+    Services.obs.removeObserver(this, "intl:app-locales-changed");
     Services.obs.removeObserver(this, "mail-startup-done");
     Services.obs.removeObserver(this, "handle-xul-text-link");
     Services.obs.removeObserver(this, "chrome-document-global-created");
 
     ExtensionSupport.unregisterWindowListener("Thunderbird-internal-Toolbox");
     ExtensionSupport.unregisterWindowListener(
       "Thunderbird-internal-BrowserConsole"
     );
   },
 
   // nsIObserver implementation
   observe(aSubject, aTopic, aData) {
+    let fs;
     switch (aTopic) {
       case "xpcom-shutdown":
         this._dispose();
         break;
+      case "intl:app-locales-changed":
+        fs = Cc["@mozilla.org/msgFolder/msgFolderService;1"].getService(
+          Ci.nsIMsgFolderService
+        );
+        fs.initializeFolderStrings();
+        break;
       case "final-ui-startup":
-        let fs = Cc["@mozilla.org/msgFolder/msgFolderService;1"].getService(
+        fs = Cc["@mozilla.org/msgFolder/msgFolderService;1"].getService(
           Ci.nsIMsgFolderService
         );
         fs.initializeFolderStrings();
         this._onProfileStartup();
         break;
       case "mail-startup-done":
         this._onMailStartupDone();
         break;