From de64e8bc697fcd3f4a7541a766a0ec5976be5b8c Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Mon, 19 Oct 2026 08:55:06 +0000 Subject: [PATCH] ui: localize the collapsed bio More label Pass the More label from a string resource into the collapsed bio splitter so the suffix width and the bold span use the translated text. --- .../com/subtracks/ui/library/ArtistDetailScreen.kt | 10 ++++++---- app/src/main/res/values/strings.xml | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/subtracks/ui/library/ArtistDetailScreen.kt b/app/src/main/kotlin/com/subtracks/ui/library/ArtistDetailScreen.kt index c91c4ea6..ad3b3396 100644 --- a/app/src/main/kotlin/com/subtracks/ui/library/ArtistDetailScreen.kt +++ b/app/src/main/kotlin/com/subtracks/ui/library/ArtistDetailScreen.kt @@ -524,6 +524,7 @@ private fun ArtistBio( val measurer = rememberTextMeasurer() val density = LocalDensity.current val style = MaterialTheme.typography.bodyMedium + val moreText = stringResource(R.string.artist_bio_more) BoxWithConstraints(modifier.fillMaxWidth().padding(top = BIO_TOP_GAP)) { val fullWidth = with(density) { maxWidth.roundToPx() } val reserve = with(density) { BIO_ACTION_RESERVE.roundToPx() } @@ -533,9 +534,9 @@ private fun ArtistBio( }.coerceAtLeast(1) val reserveLines = ceil(with(density) { BIO_ACTION_HEIGHT.toPx() } / lineHeightPx).toInt().coerceAtLeast(1) val lines = - remember(text, fullWidth, reserve, reserveLines, collapsed) { + remember(text, fullWidth, reserve, reserveLines, collapsed, moreText) { if (collapsed) { - splitBioCollapsed(measurer, text, style, fullWidth, reserve) + splitBioCollapsed(measurer, text, style, fullWidth, reserve, moreText) } else { splitBio(measurer, text, style, fullWidth, reserve, reserveLines).map { AnnotatedString(it.ifEmpty { " " }) @@ -603,6 +604,7 @@ internal fun splitBioCollapsed( style: TextStyle, fullWidth: Int, reserve: Int, + moreText: String, ): List { val words = text @@ -627,7 +629,7 @@ internal fun splitBioCollapsed( val more = buildAnnotatedString { append("… ") - withStyle(SpanStyle(fontWeight = FontWeight.Bold)) { append("More") } + withStyle(SpanStyle(fontWeight = FontWeight.Bold)) { append(moreText) } } val moreWidth = measurer.measure(more, style, maxLines = 1).size.width val secondAvailable = (available - moreWidth).coerceAtLeast(1) @@ -645,7 +647,7 @@ internal fun splitBioCollapsed( buildAnnotatedString { if (second.isNotEmpty()) append("$second ") append("… ") - withStyle(SpanStyle(fontWeight = FontWeight.Bold)) { append("More") } + withStyle(SpanStyle(fontWeight = FontWeight.Bold)) { append(moreText) } } return listOf(AnnotatedString(first), secondLine) } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4ef98d7a..5c7449b0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -38,6 +38,7 @@ Albums Appears on No artist bio available. + More %1$s · %2$s Genre Starred