Skip to content

Commit 40b5fc2

Browse files
committed
Localize KMP continue episode action
1 parent e8e7a35 commit 40b5fc2

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

multiplatform/composeApp/src/commonMain/kotlin/com/lamndt/smartmovie/multiplatform/AppController.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,9 @@ class AppController(
322322
.propagateCancellation()
323323
.onSuccess { feed ->
324324
val titles = runCatching {
325-
api.trending(snapshot.homeType.wireValue, snapshot.trendingWindow, 1, snapshot.locale.backendTag, snapshot.adultUnlocked)
326-
.results.mapNotNull { (it as? CatalogEntity.Title)?.value }
325+
(api as? CatalogApiV2)?.trending(snapshot.homeType.wireValue, snapshot.trendingWindow, 1, snapshot.locale.backendTag, snapshot.adultUnlocked)
326+
?.results.orEmpty()
327+
.mapNotNull { (it as? CatalogEntity.Title)?.value }
327328
}.getOrDefault(emptyList())
328329
mutableState.update { it.copy(home = LoadState.Content(feed), trending = titles) }
329330
}

multiplatform/composeApp/src/commonMain/kotlin/com/lamndt/smartmovie/multiplatform/SmartMovieApp.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1442,7 +1442,7 @@ private fun EntityDetailContent(
14421442
nextEpisode?.let { episode ->
14431443
Button(onClick = { controller.openEntity(CatalogEntity.Episode(episode)) }) {
14441444
Icon(Icons.Default.PlayArrow, contentDescription = null)
1445-
Text("Continue with episode", modifier = Modifier.padding(start = 8.dp))
1445+
Text(continueEpisodeLabel(state.locale), modifier = Modifier.padding(start = 8.dp))
14461446
}
14471447
}
14481448
detail.value.episodes.forEach { episode ->
@@ -1513,6 +1513,15 @@ private fun EntityDetailContent(
15131513
}
15141514
}
15151515

1516+
private fun continueEpisodeLabel(locale: AppLocale): String = when (locale) {
1517+
AppLocale.ENGLISH -> "Continue with episode"
1518+
AppLocale.VIETNAMESE -> "Tiếp tục với tập phim"
1519+
AppLocale.JAPANESE -> "エピソードを続ける"
1520+
AppLocale.KOREAN -> "에피소드 계속 보기"
1521+
AppLocale.CHINESE_SIMPLIFIED -> "继续观看剧集"
1522+
AppLocale.CHINESE_TRADITIONAL -> "繼續觀看劇集"
1523+
}
1524+
15161525
private fun creditTitle(credit: com.lamndt.smartmovie.multiplatform.model.Credit): TitleSummary? {
15171526
val id = credit.id ?: return null
15181527
val mediaType = credit.mediaType ?: return null

0 commit comments

Comments
 (0)