Bug 1479377 - Provide fallbacks for switch language in Prefs message r?gandalf draft
authorMark Striemer <mstriemer@mozilla.com>
Mon, 30 Jul 2018 15:03:51 -0500
changeset 824446 4306ade1bafadcbebf13a7f7c64c4bf34a228c75
parent 824415 1161111168cfbcbac5e92bdab486269cfda505b8
push id117907
push userbmo:mstriemer@mozilla.com
push dateMon, 30 Jul 2018 20:44:09 +0000
reviewersgandalf
bugs1479377
milestone63.0a1
Bug 1479377 - Provide fallbacks for switch language in Prefs message r?gandalf MozReview-Commit-ID: G3oeSWl1Rtf
browser/components/preferences/in-content/main.js
--- a/browser/components/preferences/in-content/main.js
+++ b/browser/components/preferences/in-content/main.js
@@ -230,20 +230,25 @@ if (AppConstants.MOZ_UPDATER) {
     ]);
   }
 }
 
 // A promise that resolves when the list of application handlers is loaded.
 // We store this in a global so tests can await it.
 var promiseLoadHandlersList;
 
-// Load the preferences string bundle for a given locale.
+// Load the preferences string bundle for a given locale with fallbacks.
 function getBundleForLocale(locale) {
+  let locales = Array.from(new Set([
+    locale,
+    ...Services.locale.getRequestedLocales(),
+    Services.locale.lastFallbackLocale,
+  ]));
   function generateContexts(resourceIds) {
-    return L10nRegistry.generateContexts([locale], resourceIds);
+    return L10nRegistry.generateContexts(locales, resourceIds);
   }
   return new Localization([
     "browser/preferences/preferences.ftl",
     "branding/brand.ftl",
   ], generateContexts);
 }
 
 var gNodeToObjectMap = new WeakMap();