Bug 1635561 - Use RegionalPrefLocales rather than AppLocale in xpc_LocalizeRuntime; r=zbraniecki

Differential Revision: https://phabricator.services.mozilla.com/D98390
This commit is contained in:
Dan Minor 2020-12-07 19:27:36 +00:00
Родитель 961ecbeca0
Коммит 0b1722fcb7
2 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -18,8 +18,7 @@ const localeService =
Cc["@mozilla.org/intl/localeservice;1"].getService(Ci.mozILocaleService);
const mozIntl = Cc["@mozilla.org/mozintl;1"].getService(Ci.mozIMozIntl);
let rpLocale = localeService.negotiateLanguages(localeService.regionalPrefsLocales,
localeService.availableLocales)[0];
let rpLocale = localeService.regionalPrefsLocales[0];
let testData = [
{

Просмотреть файл

@ -133,11 +133,12 @@ bool xpc_LocalizeRuntime(JSRuntime* rt) {
}
// No pref has been found, so get the default locale from the
// application's locale.
nsAutoCString appLocaleStr;
LocaleService::GetInstance()->GetAppLocaleAsBCP47(appLocaleStr);
// regional prefs locales.
AutoTArray<nsCString, 10> rpLocales;
LocaleService::GetInstance()->GetRegionalPrefsLocales(rpLocales);
return JS_SetDefaultLocale(rt, appLocaleStr.get());
MOZ_ASSERT(rpLocales.Length() > 0);
return JS_SetDefaultLocale(rt, rpLocales[0].get());
}
void xpc_DelocalizeRuntime(JSRuntime* rt) {