Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Mullvad Browser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dan Ballard
Mullvad Browser
Commits
ff97b6fb
Commit
ff97b6fb
authored
4 years ago
by
Alex Catarineu
Committed by
Pier Angelo Vendrame
10 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Bug 40199: Avoid using system locale for intl.accept_languages in GeckoView
parent
17e5614a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
+21
-15
21 additions, 15 deletions
...main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
with
21 additions
and
15 deletions
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
+
21
−
15
View file @
ff97b6fb
...
...
@@ -22,7 +22,7 @@ import androidx.annotation.NonNull;
import
androidx.annotation.Nullable
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.util.
LinkedHashMap
;
import
java.util.
ArrayList
;
import
java.util.Locale
;
import
org.mozilla.gecko.EventDispatcher
;
import
org.mozilla.gecko.GeckoSystemStateListener
;
...
...
@@ -791,23 +791,29 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
}
private
String
computeAcceptLanguages
()
{
final
LinkedHashMap
<
String
,
String
>
locales
=
new
LinkedHashMap
<>();
// Explicitly-set app prefs come first:
if
(
mRequestedLocales
!=
null
)
{
for
(
final
String
locale
:
mRequestedLocales
)
{
locales
.
put
(
locale
.
toLowerCase
(
Locale
.
ROOT
),
locale
);
}
}
// OS prefs come second:
for
(
final
String
locale
:
getDefaultLocales
())
{
final
String
localeLowerCase
=
locale
.
toLowerCase
(
Locale
.
ROOT
);
if
(!
locales
.
containsKey
(
localeLowerCase
))
{
locales
.
put
(
localeLowerCase
,
locale
);
final
ArrayList
<
String
>
locales
=
new
ArrayList
<
String
>();
// 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
(
Locale
.
ROOT
);
// No need to include `en-us` twice.
if
(!
locale
.
equals
(
"en-us"
))
{
locales
.
add
(
locale
);
if
(
locale
.
contains
(
"-"
))
{
String
lang
=
locale
.
split
(
"-"
)[
0
];
// No need to include `en` twice.
if
(!
lang
.
equals
(
"en"
))
{
locales
.
add
(
lang
);
}
}
}
}
locales
.
add
(
"en-us"
);
locales
.
add
(
"en"
);
return
TextUtils
.
join
(
","
,
locales
.
values
()
);
return
TextUtils
.
join
(
","
,
locales
);
}
private
static
String
[]
getDefaultLocales
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment