Commit 45bb9d2e authored by Alex Catarineu's avatar Alex Catarineu Committed by Matthew Finkel
Browse files

Bug 40199: Avoid using system locale for intl.accept_languages in GeckoView

parent 189133d8
...@@ -778,19 +778,25 @@ public final class GeckoRuntimeSettings extends RuntimeSettings { ...@@ -778,19 +778,25 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
private String computeAcceptLanguages() { private String computeAcceptLanguages() {
final ArrayList<String> locales = new ArrayList<String>(); final ArrayList<String> locales = new ArrayList<String>();
// Explicitly-set app prefs come first: // In Desktop, these are defined in the `intl.accept_languages` localized property.
if (mRequestedLocales != null) { // At some point we should probably use the same values here, but for now we use a simple
for (final String locale : mRequestedLocales) { // strategy which will hopefully result in reasonable acceptLanguage values.
locales.add(locale.toLowerCase(Locale.ROOT)); if (mRequestedLocales != null && mRequestedLocales.length > 0) {
} String locale = mRequestedLocales[0].toLowerCase(Locale.ROOT);
} // No need to include `en-us` twice.
// OS prefs come second: if (!locale.equals("en-us")) {
for (final String locale : getDefaultLocales()) { locales.add(locale);
final String localeLowerCase = locale.toLowerCase(Locale.ROOT); if (locale.contains("-")) {
if (!locales.contains(localeLowerCase)) { String lang = locale.split("-")[0];
locales.add(localeLowerCase); // No need to include `en` twice.
if (!lang.equals("en")) {
locales.add(lang);
}
}
} }
} }
locales.add("en-us");
locales.add("en");
return TextUtils.join(",", locales); return TextUtils.join(",", locales);
} }
......
Markdown is supported
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