From e0d368a3d9396b8e0c783537cb9fb4528be1c21f Mon Sep 17 00:00:00 2001 From: Arpita kesharwani <107834813+KesharwaniArpita@users.noreply.github.com> Date: Sat, 19 Oct 2024 19:01:30 +0530 Subject: [PATCH] Update LanguageSettingsFragment.kt --- .../fragments/LanguageSettingsFragment.kt | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/be/scri/fragments/LanguageSettingsFragment.kt b/app/src/main/java/be/scri/fragments/LanguageSettingsFragment.kt index 59f82523..c07b76ed 100644 --- a/app/src/main/java/be/scri/fragments/LanguageSettingsFragment.kt +++ b/app/src/main/java/be/scri/fragments/LanguageSettingsFragment.kt @@ -261,17 +261,15 @@ class LanguageSettingsFragment : Fragment() { } fun getLanguageStringFromi18n(language: String): Int { - val languageStringResource = when (language) { - "German" -> R.string.app__global_german - "French" -> R.string.app__global_french - "Spanish" -> R.string.app__global_spanish - "Italian" -> R.string.app__global_italian - "Russian" -> R.string.app__global_russian - "Portuguese" -> R.string.app__global_portuguese - "Swedish" -> R.string.app__global_swedish - else -> R.string.app__global_english - } - return languageStringResource + val languageMap = mapOf( + "German" to R.string.app__global_german, + "French" to R.string.app__global_french, + "Spanish" to R.string.app__global_spanish, + "Italian" to R.string.app__global_italian, + "Russian" to R.string.app__global_russian, + "Portuguese" to R.string.app__global_portuguese, + "Swedish" to R.string.app__global_swedish + ) + return languageMap[language] ?: R.string.app__global_english } - }