81cc07
diff -up firefox-51.0/toolkit/mozapps/extensions/internal/XPIProvider.jsm.1005640-accept-lang firefox-51.0/toolkit/mozapps/extensions/internal/XPIProvider.jsm
81cc07
--- firefox-51.0/toolkit/mozapps/extensions/internal/XPIProvider.jsm.1005640-accept-lang	2017-01-16 17:16:52.000000000 +0100
81cc07
+++ firefox-51.0/toolkit/mozapps/extensions/internal/XPIProvider.jsm	2017-01-18 12:35:29.380394216 +0100
81cc07
@@ -2852,6 +2852,11 @@ this.XPIProvider = {
81cc07
         this.addAddonsToCrashReporter();
81cc07
       }
81cc07
 
81cc07
+      // Save locale settings to compare it later to check whenever some addon
81cc07
+      // changed it.
81cc07
+      var previousLocale = Cc["@mozilla.org/chrome/chrome-registry;1"]
81cc07
+                          .getService(Ci.nsIXULChromeRegistry).getSelectedLocale("global");
81cc07
+
81cc07
       try {
81cc07
         AddonManagerPrivate.recordTimestamp("XPI_bootstrap_addons_begin");
81cc07
 
81cc07
@@ -2880,6 +2885,14 @@ this.XPIProvider = {
81cc07
         AddonManagerPrivate.recordException("XPI-BOOTSTRAP", "startup failed", e);
81cc07
       }
81cc07
 
81cc07
+      var currentLocale = Cc["@mozilla.org/chrome/chrome-registry;1"]
81cc07
+                         .getService(Ci.nsIXULChromeRegistry).getSelectedLocale("global");
81cc07
+      if (currentLocale != previousLocale) {
81cc07
+        // We have to flush string cache if the locale was changed during loading
81cc07
+        // of addons
81cc07
+        Services.obs.notifyObservers(null, "chrome-flush-caches", null);
81cc07
+      }
81cc07
+
81cc07
       // Let these shutdown a little earlier when they still have access to most
81cc07
       // of XPCOM
81cc07
       Services.obs.addObserver({