Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 2481293004: Use LocaleList in Android/Webview locale representation (Closed)
Patch Set: description changes Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/java/src/org/chromium/android_webview/AwContents.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index 45a360b4f9da94ff9fe8607a1c29090fe6c44221..c75d4a5e67e134e6c8a1bfcdeb66ddd654f5d435 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -359,7 +359,7 @@ public class AwContents implements SmartClipProvider,
// Do not use directly, call isDestroyed() instead.
private boolean mIsDestroyed = false;
- private static String sCurrentLocale = "";
+ private static String sCurrentLocales = "";
private static final class AwContentsDestroyRunnable implements Runnable {
private final long mNativeAwContents;
@@ -693,7 +693,11 @@ public class AwContents implements SmartClipProvider,
@Override
public void onConfigurationChanged(Configuration configuration) {
- setLocale(LocaleUtils.toLanguageTag(configuration.locale));
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ setLocale(LocaleUtils.toLanguageTags(configuration.getLocales()));
+ } else {
+ setLocale(LocaleUtils.toLanguageTag(configuration.locale));
+ }
mSettings.updateAcceptLanguages();
}
};
@@ -1002,11 +1006,12 @@ public class AwContents implements SmartClipProvider,
return wrapper;
}
+ // Deal with a string that represents either a single locale or a locale list.
@VisibleForTesting
- public static void setLocale(String locale) {
- if (!sCurrentLocale.equals(locale)) {
- sCurrentLocale = locale;
- nativeSetLocale(sCurrentLocale);
+ public static void setLocale(String locales) {
+ if (!sCurrentLocales.equals(locales)) {
+ sCurrentLocales = locales;
+ nativeSetLocale(sCurrentLocales);
}
}
« no previous file with comments | « no previous file | base/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698