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

Fixes lanaguages when using lang-script-region type. #1860

Merged
merged 1 commit into from
Sep 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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