diff --git a/app/src/main/java/com/sevtinge/hyperceiler/utils/LanguageHelper.java b/app/src/main/java/com/sevtinge/hyperceiler/utils/LanguageHelper.java index 8bd91a3d0..f6a7cbf4f 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/utils/LanguageHelper.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/utils/LanguageHelper.java @@ -138,11 +138,20 @@ public static String newLanguage(String language, String country) { } public static int resultIndex(String[] languages, String value) { - int index = -1; - for (String l : languages) { - index = index + 1; - if (l.equals(value)) { - return index; + + String targetLanguage = value.split("_")[0]; + + for (int i = 0; i < languages.length; i++) { + String currentLang = languages[i]; + if (currentLang == null) continue; + + if (currentLang.equals(value)) { + return i; + } + + String currentLanguage = currentLang.split("_")[0]; + if (targetLanguage.equals(currentLanguage)) { + return i; // Language匹配成功 } } return -1;