From 1ac95a2ce0391e1f809b47f482856d26f8aca65b Mon Sep 17 00:00:00 2001 From: machiav3lli Date: Sat, 17 Sep 2022 16:15:29 +0200 Subject: [PATCH] Fix: Show language name instead of code in Pref's summary --- .../fdroid/ui/compose/components/prefs/BasicPrefs.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/components/prefs/BasicPrefs.kt b/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/components/prefs/BasicPrefs.kt index e675f8d4..f5546e3f 100644 --- a/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/components/prefs/BasicPrefs.kt +++ b/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/components/prefs/BasicPrefs.kt @@ -32,6 +32,11 @@ import com.machiav3lli.fdroid.content.BooleanPrefsMeta import com.machiav3lli.fdroid.content.NonBooleanPrefsMeta import com.machiav3lli.fdroid.content.Preferences import com.machiav3lli.fdroid.ui.compose.utils.addIf +import com.machiav3lli.fdroid.utility.Utils +import com.machiav3lli.fdroid.utility.Utils.getLocaleOfCode +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch @Composable fun BasePreference( @@ -158,10 +163,12 @@ fun StringPreference( isEnabled: Boolean = true, onClick: (() -> Unit) = {}, ) { + val context = LocalContext.current + BasePreference( modifier = modifier, titleId = NonBooleanPrefsMeta[prefKey] ?: -1, - summary = Preferences[prefKey], + summary = Utils.translateLocale(context.getLocaleOfCode(Preferences[prefKey])), index = index, groupSize = groupSize, isEnabled = isEnabled,