From a32727da3eee8eea337e1b356e81cbc816254a65 Mon Sep 17 00:00:00 2001 From: Daosheng Mu Date: Thu, 19 Sep 2019 14:20:28 -0700 Subject: [PATCH] Fixes lanaguages when using lang-script-region type. (#1860) --- .../shared/org/mozilla/vrbrowser/utils/LocaleUtils.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/utils/LocaleUtils.java b/app/src/common/shared/org/mozilla/vrbrowser/utils/LocaleUtils.java index fca8a5bb9..970363ae4 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/utils/LocaleUtils.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/utils/LocaleUtils.java @@ -52,7 +52,6 @@ private static HashMap getAllLanguages() { return mLanguagesCache; } - String currentLocale = getCurrentLocale(); Locale[] locales = Locale.getAvailableLocales(); mLanguagesCache = new HashMap<>(); for(Locale temp : locales) { @@ -184,8 +183,7 @@ public static Context setLocale(@NonNull Context context) { } private static Context updateResources(@NonNull Context context, @NonNull String language) { - String[] localeStr = language.split("-"); - Locale locale = new Locale(localeStr[0], localeStr.length > 1 ? localeStr[1] : ""); + Locale locale = Locale.forLanguageTag(language); Locale.setDefault(locale); Resources res = context.getResources();