1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-12-23 13:26:59 +00:00

proper locale country handling

This commit is contained in:
Austin Huang 2020-11-13 18:06:57 -05:00
parent 387a56faf5
commit 0487d23907
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F

View File

@ -22,7 +22,8 @@ public final class LocaleUtils {
final String lang = LocaleUtils.getCorrespondingLanguageCode(baseContext); final String lang = LocaleUtils.getCorrespondingLanguageCode(baseContext);
currentLocale = TextUtils.isEmpty(lang) ? defaultLocale : new Locale(lang); currentLocale = TextUtils.isEmpty(lang) ? defaultLocale :
(lang.contains("_") ? new Locale(lang.split("_")[0], lang.split("_")[1]) : new Locale(lang));
Locale.setDefault(currentLocale); Locale.setDefault(currentLocale);
final Resources res = baseContext.getResources(); final Resources res = baseContext.getResources();
@ -62,7 +63,7 @@ public final class LocaleUtils {
if (appLanguageIndex == 1) return "en"; if (appLanguageIndex == 1) return "en";
if (appLanguageIndex == 2) return "fr"; if (appLanguageIndex == 2) return "fr";
if (appLanguageIndex == 3) return "es"; if (appLanguageIndex == 3) return "es";
if (appLanguageIndex == 4) return "zh-rCN"; if (appLanguageIndex == 4) return "zh_CN";
if (appLanguageIndex == 5) return "in"; if (appLanguageIndex == 5) return "in";
if (appLanguageIndex == 6) return "it"; if (appLanguageIndex == 6) return "it";
if (appLanguageIndex == 7) return "de"; if (appLanguageIndex == 7) return "de";
@ -72,7 +73,7 @@ public final class LocaleUtils {
if (appLanguageIndex == 11) return "fa"; if (appLanguageIndex == 11) return "fa";
if (appLanguageIndex == 12) return "mk"; if (appLanguageIndex == 12) return "mk";
if (appLanguageIndex == 13) return "vi"; if (appLanguageIndex == 13) return "vi";
if (appLanguageIndex == 14) return "zh-rTW"; if (appLanguageIndex == 14) return "zh_TW";
if (appLanguageIndex == 15) return "hi"; if (appLanguageIndex == 15) return "hi";
if (appLanguageIndex == 16) return "cs"; if (appLanguageIndex == 16) return "cs";