diff --git a/app/src/main/java/com/lagradost/cloudstream3/CommonActivity.kt b/app/src/main/java/com/lagradost/cloudstream3/CommonActivity.kt index 47a195d1..402866d8 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/CommonActivity.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/CommonActivity.kt @@ -107,10 +107,19 @@ object CommonActivity { logError(e) } } + + /** + * Not all languages can be fetched from locale with a code. + * This map allows sidestepping the default Locale(languageCode) + * when setting the app language. + **/ + val appLanguageExceptions = hashMapOf( + "zh-TW" to Locale.TRADITIONAL_CHINESE + ) fun setLocale(context: Context?, languageCode: String?) { if (context == null || languageCode == null) return - val locale = Locale(languageCode) + val locale = appLanguageExceptions[languageCode] ?: Locale(languageCode) val resources: Resources = context.resources val config = resources.configuration Locale.setDefault(locale) @@ -421,4 +430,4 @@ object CommonActivity { } return null } -} \ No newline at end of file +}