diff --git a/dom/apps/AppsUtils.jsm b/dom/apps/AppsUtils.jsm index b2983167691..8374b1396ec 100644 --- a/dom/apps/AppsUtils.jsm +++ b/dom/apps/AppsUtils.jsm @@ -785,7 +785,7 @@ this.AppsUtils = { /** * Helper object to access manifest information with locale support */ -this.ManifestHelper = function(aManifest, aOrigin, aManifestURL) { +this.ManifestHelper = function(aManifest, aOrigin, aManifestURL, aLang) { // If the app is packaged, we resolve uris against the origin. // If it's not, against the manifest url. @@ -801,10 +801,15 @@ this.ManifestHelper = function(aManifest, aOrigin, aManifestURL) { this._manifestURL = Services.io.newURI(aManifestURL, null, null); this._manifest = aManifest; - let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"] - .getService(Ci.nsIXULChromeRegistry) - .QueryInterface(Ci.nsIToolkitChromeRegistry); - let locale = chrome.getSelectedLocale("global").toLowerCase(); + + let locale = aLang; + if (!locale) { + let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"] + .getService(Ci.nsIXULChromeRegistry) + .QueryInterface(Ci.nsIToolkitChromeRegistry); + locale = chrome.getSelectedLocale("global").toLowerCase(); + } + this._localeRoot = this._manifest; if (this._manifest.locales && this._manifest.locales[locale]) { diff --git a/dom/apps/Langpacks.jsm b/dom/apps/Langpacks.jsm index b2e1769163c..c3dfd4aa567 100644 --- a/dom/apps/Langpacks.jsm +++ b/dom/apps/Langpacks.jsm @@ -245,7 +245,7 @@ this.Langpacks = { // We need to get the app with the manifest since the version is only // available in the manifest. - this._appFromManifestURL(aData.manifestURL, aData.entryPoint) + this._appFromManifestURL(aData.manifestURL, aData.entryPoint, aData.lang) .then(aApp => { let manifest = aApp.manifest; diff --git a/dom/apps/Webapps.jsm b/dom/apps/Webapps.jsm index 022f468f15b..8682d897f20 100755 --- a/dom/apps/Webapps.jsm +++ b/dom/apps/Webapps.jsm @@ -4674,7 +4674,7 @@ this.DOMApplicationRegistry = { }, // Returns a promise that resolves to the app object with the manifest. - getFullAppByManifestURL: function(aManifestURL, aEntryPoint) { + getFullAppByManifestURL: function(aManifestURL, aEntryPoint, aLang) { let app = this.getAppByManifestURL(aManifestURL); if (!app) { return Promise.reject("NoSuchApp"); @@ -4692,7 +4692,8 @@ this.DOMApplicationRegistry = { manifest.version = aManifest.version; } - app.manifest = new ManifestHelper(manifest, app.origin, app.manifestURL); + app.manifest = + new ManifestHelper(manifest, app.origin, app.manifestURL, aLang); return app; }); },