GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still and

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