Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Fixes lanaguages when using lang-script-region type. (#1860)
Browse files Browse the repository at this point in the history
  • Loading branch information
daoshengmu authored and bluemarvin committed Sep 19, 2019
1 parent b3f1078 commit a32727d
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ private static HashMap<String, Language> getAllLanguages() {
return mLanguagesCache;
}

String currentLocale = getCurrentLocale();
Locale[] locales = Locale.getAvailableLocales();
mLanguagesCache = new HashMap<>();
for(Locale temp : locales) {
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit a32727d

Please sign in to comment.