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