Browse Source

proper locale country handling

renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
0487d23907
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 7
      app/src/main/java/awais/instagrabber/utils/LocaleUtils.java

7
app/src/main/java/awais/instagrabber/utils/LocaleUtils.java

@ -22,7 +22,8 @@ public final class LocaleUtils {
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);
final Resources res = baseContext.getResources();
@ -62,7 +63,7 @@ public final class LocaleUtils {
if (appLanguageIndex == 1) return "en";
if (appLanguageIndex == 2) return "fr";
if (appLanguageIndex == 3) return "es";
if (appLanguageIndex == 4) return "zh-rCN";
if (appLanguageIndex == 4) return "zh_CN";
if (appLanguageIndex == 5) return "in";
if (appLanguageIndex == 6) return "it";
if (appLanguageIndex == 7) return "de";
@ -72,7 +73,7 @@ public final class LocaleUtils {
if (appLanguageIndex == 11) return "fa";
if (appLanguageIndex == 12) return "mk";
if (appLanguageIndex == 13) return "vi";
if (appLanguageIndex == 14) return "zh-rTW";
if (appLanguageIndex == 14) return "zh_TW";
if (appLanguageIndex == 15) return "hi";
if (appLanguageIndex == 16) return "cs";

Loading…
Cancel
Save