Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor Browser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Applications
Tor Browser
Commits
ec41c8be
Verified
Commit
ec41c8be
authored
Oct 20, 2020
by
Alex Catarineu
Committed by
Pier Angelo Vendrame
Jun 29, 2023
Browse files
Options
Downloads
Patches
Plain Diff
Bug 40199: Avoid using system locale for intl.accept_languages in GeckoView
parent
348ee770
No related branches found
No related tags found
1 merge request
!694
Bug 41796: Rebased on top of FIREFOX_ESR_115_BASE
Changes
1
Show 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 @
ec41c8be
...
...
@@ -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
<
>();
final
ArrayList
<
String
>
locales
=
new
ArrayList
<
String
>();
// Explicitly-set app prefs come first:
if
(
mRequestedLocales
!=
null
)
{
for
(
final
String
locale
:
mRequestedLocales
)
{
locales
.
put
(
locale
.
toLowerCase
(
Locale
.
ROOT
),
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
(
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
);
}
}
// OS prefs come second:
for
(
final
String
locale
:
getDefaultLocales
())
{
final
String
localeLowerCase
=
locale
.
toLowerCase
(
Locale
.
ROOT
);
if
(!
locales
.
containsKey
(
localeLowerCase
))
{
locales
.
put
(
localeLowerCase
,
locale
);
}
}
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
sign in
to comment