From 0487d23907f82c7893b62f8dde90873e60ef7645 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Fri, 13 Nov 2020 18:06:57 -0500 Subject: [PATCH] proper locale country handling --- .../main/java/awais/instagrabber/utils/LocaleUtils.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/utils/LocaleUtils.java b/app/src/main/java/awais/instagrabber/utils/LocaleUtils.java index 0ccfecbc..988fd6d5 100755 --- a/app/src/main/java/awais/instagrabber/utils/LocaleUtils.java +++ b/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";