Unverified Commit 61ed6410 authored by Alex Catarineu's avatar Alex Catarineu Committed by Matthew Finkel
Browse files

Bug 40309: Avoid using regional OS locales

Only use regional OS locales if the pref
`intl.regional_prefs.use_os_locales` is set to true.
parent 4c1d52e0
......@@ -459,31 +459,6 @@ LocaleService::GetRegionalPrefsLocales(nsTArray<nsCString>& aRetVal) {
OSPreferences::GetInstance()->GetRegionalPrefsLocales(aRetVal))) {
return NS_OK;
// If we fail to retrieve them, return the app locales.
return NS_OK;
// Otherwise, fetch OS Regional Preferences locales and compare the first one
// to the app locale. If the language subtag matches, we can safely use
// the OS Regional Preferences locale.
// This facilitates scenarios such as Firefox in "en-US" and User sets
// regional prefs to "en-GB".
nsAutoCString appLocale;
AutoTArray<nsCString, 10> regionalPrefsLocales;
if (NS_FAILED(OSPreferences::GetInstance()->GetRegionalPrefsLocales(
regionalPrefsLocales))) {
return NS_OK;
if (LocaleService::LanguagesMatch(appLocale, regionalPrefsLocales[0])) {
aRetVal = regionalPrefsLocales.Clone();
return NS_OK;
// Otherwise use the app locales.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment