From 9aad985aeafdd07adf8e2a6d3b11021015d5ce49 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sat, 7 May 2022 21:44:52 +0200 Subject: [PATCH] Fixed Languages with specific countries --- app/src/main/java/com/github/libretube/MainActivity.kt | 4 +++- app/src/main/res/values/array.xml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/libretube/MainActivity.kt b/app/src/main/java/com/github/libretube/MainActivity.kt index 49a497a30..f68cf203b 100644 --- a/app/src/main/java/com/github/libretube/MainActivity.kt +++ b/app/src/main/java/com/github/libretube/MainActivity.kt @@ -43,8 +43,10 @@ class MainActivity : AppCompatActivity() { DynamicColors.applyToActivitiesIfAvailable(application) val languageName = sharedPreferences.getString("language", "sys") if (languageName != "") { - var locale = if (languageName != "sys") { + var locale = if (languageName != "sys" && "$languageName".length < 3 ){ Locale(languageName) + } else if ("$languageName".length > 3) { + Locale(languageName?.substring(0,2), languageName?.substring(4,6)) } else { Locale.getDefault() } diff --git a/app/src/main/res/values/array.xml b/app/src/main/res/values/array.xml index d2bd2232d..a68fe1239 100644 --- a/app/src/main/res/values/array.xml +++ b/app/src/main/res/values/array.xml @@ -452,7 +452,7 @@ fa pl pt - pr-rBR + pt-rBR ru ckb es