diff --git a/app/src/main/kotlin/org/cru/godtools/ui/languages/LanguageName+Previews.kt b/app/src/main/kotlin/org/cru/godtools/ui/languages/LanguageName+Previews.kt index 795a60bf94..268517cca7 100644 --- a/app/src/main/kotlin/org/cru/godtools/ui/languages/LanguageName+Previews.kt +++ b/app/src/main/kotlin/org/cru/godtools/ui/languages/LanguageName+Previews.kt @@ -16,6 +16,8 @@ private fun LeftToRightLanguageNames() = Column { HorizontalDivider() LanguageName(Locale.ENGLISH) HorizontalDivider() + LanguageName(language = nameLanguage) + HorizontalDivider() LanguageName(language = forcedNameLanguage) } @@ -28,6 +30,8 @@ private fun RightToLeftLanguageNames() = Column { HorizontalDivider() LanguageName(Locale.ENGLISH) HorizontalDivider() + LanguageName(language = nameLanguage) + HorizontalDivider() LanguageName(language = forcedNameLanguage) } @@ -36,3 +40,9 @@ private val forcedNameLanguage = Language( name = "German", isForcedName = true, ) + +private val nameLanguage = Language( + code = Locale.UK, + name = "German", + isForcedName = false, +) diff --git a/app/src/main/kotlin/org/cru/godtools/ui/languages/LanguageName.kt b/app/src/main/kotlin/org/cru/godtools/ui/languages/LanguageName.kt index 16b8a14d8e..10ac53c19c 100644 --- a/app/src/main/kotlin/org/cru/godtools/ui/languages/LanguageName.kt +++ b/app/src/main/kotlin/org/cru/godtools/ui/languages/LanguageName.kt @@ -40,10 +40,8 @@ internal fun LanguageName(language: Language, modifier: Modifier = Modifier) { val context = LocalContext.current LanguageName( - name = remember(context, language, appLanguage) { language.getDisplayName(context, language.code) }, - secondName = remember(context, language) { - language.takeUnless { it.isForcedName }?.getDisplayName(context, appLanguage) - }, + name = remember(context, language) { language.getDisplayName(context, language.code) }, + secondName = remember(context, language, appLanguage) { language.getDisplayName(context, appLanguage) }, modifier = modifier, ) } @@ -51,7 +49,7 @@ internal fun LanguageName(language: Language, modifier: Modifier = Modifier) { private const val LANGUAGE_NAME_GAP = "[gap]" @Composable -private fun LanguageName(name: String, secondName: String?, modifier: Modifier = Modifier) { +private fun LanguageName(name: String, secondName: String, modifier: Modifier = Modifier) { val color = LocalTextStyle.current.color.takeOrElse { LocalContentColor.current } val secondNameColor = color.let { it.copy(alpha = it.alpha * 0.60f) } @@ -59,10 +57,8 @@ private fun LanguageName(name: String, secondName: String?, modifier: Modifier = remember(name, secondName, color, secondNameColor) { buildAnnotatedString { withStyle(SpanStyle(color = color)) { append(name) } - if (secondName != null) { - appendInlineContent(LANGUAGE_NAME_GAP, " ") - withStyle(SpanStyle(color = secondNameColor)) { append(secondName) } - } + appendInlineContent(LANGUAGE_NAME_GAP, " ") + withStyle(SpanStyle(color = secondNameColor)) { append(secondName) } } }, maxLines = 1, diff --git a/app/src/test/snapshots/images/org.cru.godtools.ui.languages_LanguageNamePaparazziTest_LanguageNames()[NIGHT].png b/app/src/test/snapshots/images/org.cru.godtools.ui.languages_LanguageNamePaparazziTest_LanguageNames()[NIGHT].png index c2e0f67bb8..060d0e4ddb 100644 --- a/app/src/test/snapshots/images/org.cru.godtools.ui.languages_LanguageNamePaparazziTest_LanguageNames()[NIGHT].png +++ b/app/src/test/snapshots/images/org.cru.godtools.ui.languages_LanguageNamePaparazziTest_LanguageNames()[NIGHT].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:03ac32f2fbfba8fe1a64d4194063e015b6d31b3540ca4d8dd4a2882195716d80 -size 44764 +oid sha256:a1bad97d40a3450c8f6a1347bfceac5f9f6c26ca265e551743ce424d55f94e8a +size 51107 diff --git a/app/src/test/snapshots/images/org.cru.godtools.ui.languages_LanguageNamePaparazziTest_LanguageNames()[NOTNIGHT].png b/app/src/test/snapshots/images/org.cru.godtools.ui.languages_LanguageNamePaparazziTest_LanguageNames()[NOTNIGHT].png index dfe01c62d5..679104a251 100644 --- a/app/src/test/snapshots/images/org.cru.godtools.ui.languages_LanguageNamePaparazziTest_LanguageNames()[NOTNIGHT].png +++ b/app/src/test/snapshots/images/org.cru.godtools.ui.languages_LanguageNamePaparazziTest_LanguageNames()[NOTNIGHT].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f6318d09e43f2a82f76b7fb6b6cdc904020defb84cbfe1c96876df978431d7da -size 39570 +oid sha256:b3232bc998c2750119fddbbb23fc92e1d25683a7a37c9b270f541033eb14e851 +size 44945