Skip to content

Commit 2f1e6bc

Browse files
committed
Update locales
1 parent 41115be commit 2f1e6bc

File tree

13 files changed

+54
-46
lines changed

13 files changed

+54
-46
lines changed

app/src/main/kotlin/com/revolgenx/anilib/character/ui/model/CharacterModel.kt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package com.revolgenx.anilib.character.ui.model
22

3-
import android.text.Spanned
3+
import android.content.Context
44
import androidx.compose.runtime.MutableState
55
import androidx.compose.runtime.mutableStateOf
66
import com.revolgenx.anilib.CharacterQuery
7-
import com.revolgenx.anilib.common.ext.anilify
8-
import com.revolgenx.anilib.common.ext.markdown
97
import com.revolgenx.anilib.common.ui.model.BaseModel
108
import com.revolgenx.anilib.common.ui.model.FuzzyDateModel
119
import com.revolgenx.anilib.common.ui.model.toModel
@@ -35,26 +33,25 @@ data class CharacterModel(
3533
val description: String? = null,
3634
val image: CharacterImageModel? = null,
3735

38-
var spannedDescription: Spanned? = null,
3936
) : BaseModel {
40-
fun generalDescription(): String {
37+
fun generalDescription(context: Context): String {
4138
var generalInfo = ""
4239
dateOfBirth?.let {
4340
val month = it.month?.let { m ->
4441
Month.of(m).getDisplayName(TextStyle.SHORT, Locale.getDefault())
4542
} ?: ""
4643
val day = it.day ?: ""
4744
val year = it.year ?: ""
48-
generalInfo += "<b>Birthday:</b> $month $day, $year \n"
45+
generalInfo += "<b>${context.getString(anilib.i18n.R.string.birthday)}:</b> $month $day, $year \n"
4946
}
5047
age?.let {
51-
generalInfo += "<b>Age:</b> $it \n"
48+
generalInfo += "<b>${context.getString(anilib.i18n.R.string.age)}:</b> $it \n"
5249
}
5350
gender?.let {
54-
generalInfo += "<b>Gender:</b> $it \n"
51+
generalInfo += "<b>${context.getString(anilib.i18n.R.string.gender)}:</b> $it \n"
5552
}
5653
bloodType?.let {
57-
generalInfo += "<b>Blood Type:</b> $it \n"
54+
generalInfo += "<b>${context.getString(anilib.i18n.R.string.blood_type)}:</b> $it \n"
5855
}
5956

6057
if (generalInfo.isNotBlank()) {
@@ -87,8 +84,6 @@ fun CharacterQuery.Character.toModel(): CharacterModel {
8784
},
8885
image = image?.characterImage?.toModel()
8986
)
90-
model.spannedDescription =
91-
markdown.toMarkdown(model.generalDescription() + anilify(model.description))
9287

9388
return model
9489
}

app/src/main/kotlin/com/revolgenx/anilib/character/ui/screen/CharacterAboutScreen.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ package com.revolgenx.anilib.character.ui.screen
22

33
import androidx.compose.runtime.Composable
44
import androidx.compose.runtime.LaunchedEffect
5+
import androidx.compose.runtime.remember
56
import androidx.compose.runtime.rememberCoroutineScope
67
import com.revolgenx.anilib.character.ui.viewmodel.CharacterAboutViewModel
8+
import com.revolgenx.anilib.common.ext.anilify
79
import com.revolgenx.anilib.common.ext.imageViewerScreen
810
import com.revolgenx.anilib.common.ext.localContext
911
import com.revolgenx.anilib.common.ext.localSnackbarHostState
12+
import com.revolgenx.anilib.common.ext.markdown
1013
import com.revolgenx.anilib.common.ext.naText
1114
import com.revolgenx.anilib.common.ext.orZero
1215
import com.revolgenx.anilib.common.ext.showLoginMsg
@@ -35,14 +38,17 @@ fun CharacterAboutScreen(
3538
}
3639

3740
ResourceScreen(viewModel = viewModel) { character ->
41+
val description = remember(viewModel) {
42+
markdown.toMarkdown(character.generalDescription(context) + anilify(character.description))
43+
}
3844
EntityAboutScreenContent(
3945
name = character.name?.full.naText(),
4046
alternative = character.name?.alternativeText,
4147
imageUrl = character.image?.image,
4248
favourites = character.favourites.orZero(),
4349
isFavourite = character.isFavourite.value,
4450
description = character.description,
45-
spannedDescription = character.spannedDescription,
51+
spannedDescription = description,
4652
onFavouriteClick = {
4753
if(isLoggedIn){
4854
viewModel.toggleFavorite()

app/src/main/kotlin/com/revolgenx/anilib/media/ui/screen/MediaStatsScreen.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import androidx.compose.ui.Modifier
2626
import androidx.compose.ui.graphics.Color
2727
import androidx.compose.ui.res.stringArrayResource
2828
import androidx.compose.ui.res.stringResource
29+
import androidx.compose.ui.text.style.TextAlign
2930
import androidx.compose.ui.text.style.TextOverflow
3031
import androidx.compose.ui.unit.dp
3132
import androidx.compose.ui.unit.sp
@@ -189,15 +190,18 @@ private fun StatsStatusDistributionSection(
189190
) {
190191
Text(
191192
modifier = Modifier
192-
.align(Alignment.CenterStart)
193+
.fillMaxWidth()
194+
.align(Alignment.Center)
193195
.clickable {
194196
onAmountClick(item.amount)
195197
},
196198
text = stringResource(id = I18nR.string.status_distribution_string).format(
197199
item.amount.prettyNumberFormat(),
198200
listStatus
199201
),
202+
textAlign = TextAlign.Center,
200203
color = Color.White,
204+
fontSize = 13.sp,
201205
maxLines = 2,
202206
overflow = TextOverflow.Ellipsis
203207
)

app/src/main/kotlin/com/revolgenx/anilib/staff/ui/model/StaffModel.kt

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package com.revolgenx.anilib.staff.ui.model
22

3-
import android.text.Spanned
3+
import android.content.Context
44
import androidx.compose.runtime.MutableState
55
import androidx.compose.runtime.mutableStateOf
66
import com.revolgenx.anilib.StaffQuery
77
import com.revolgenx.anilib.character.ui.model.CharacterConnectionModel
8-
import com.revolgenx.anilib.common.ext.anilify
9-
import com.revolgenx.anilib.common.ext.markdown
108
import com.revolgenx.anilib.common.ext.naText
119
import com.revolgenx.anilib.common.ui.model.BaseModel
1210
import com.revolgenx.anilib.common.ui.model.FuzzyDateModel
@@ -48,44 +46,42 @@ data class StaffModel(
4846
// Media where the staff member has a production role
4947
val staffMedia: MediaConnectionModel? = null,
5048
val yearsActive: List<Int>? = null,
51-
52-
var spannedDescription: Spanned? = null,
5349
) : BaseModel {
54-
fun generalDescription(): String {
50+
fun generalDescription(context: Context): String {
5551
var generalInfo = ""
5652
dateOfBirth?.let {
5753
val month = it.month?.let { m ->
5854
Month.of(m).getDisplayName(TextStyle.SHORT, Locale.getDefault())
5955
} ?: ""
6056
val day = it.day ?: ""
6157
val year = it.year ?: ""
62-
generalInfo += "<b>Birth:</b> $month $day, $year \n"
58+
generalInfo += "<b>${context.getString(anilib.i18n.R.string.birth)}:</b> $month $day, $year \n"
6359
}
6460
dateOfDeath?.let {
6561
val month = it.month?.let { m ->
6662
Month.of(m).getDisplayName(TextStyle.SHORT, Locale.getDefault())
6763
} ?: ""
6864
val day = it.day ?: ""
6965
val year = it.year ?: ""
70-
generalInfo += "<b>Death:</b> $month $day, $year \n"
66+
generalInfo += "<b>${context.getString(anilib.i18n.R.string.death)}:</b> $month $day, $year \n"
7167
}
7268
age?.let {
73-
generalInfo += "<b>Age:</b> $it \n"
69+
generalInfo += "<b>${context.getString(anilib.i18n.R.string.age)}:</b> $it \n"
7470
}
7571
gender?.let {
76-
generalInfo += "<b>Gender:</b> $it \n"
72+
generalInfo += "<b>${context.getString(anilib.i18n.R.string.gender)}:</b> $it \n"
7773
}
7874
bloodType?.let {
79-
generalInfo += "<b>Blood Type:</b> $it \n"
75+
generalInfo += "<b>${context.getString(anilib.i18n.R.string.blood_type)}:</b> $it \n"
8076
}
8177
yearsActive?.takeIf { it.isNotEmpty() }?.let {
8278
val firstDate = it.getOrNull(0).naText()
83-
val lastDate = it.getOrNull(1) ?: "Present"
84-
generalInfo += "<b>Years active:</b> $firstDate-$lastDate \n"
79+
val lastDate = it.getOrNull(1) ?: context.getString(anilib.i18n.R.string.present)
80+
generalInfo += "<b>${context.getString(anilib.i18n.R.string.years_active)}:</b> $firstDate-$lastDate \n"
8581
}
8682

8783
homeTown?.let {
88-
generalInfo += "<b>Hometown:</b> $it \n"
84+
generalInfo += "<b>${context.getString(anilib.i18n.R.string.hometown)}:</b> $it \n"
8985
}
9086

9187
if (generalInfo.isNotBlank()) {
@@ -118,8 +114,6 @@ fun StaffQuery.Staff.toModel(): StaffModel {
118114
yearsActive = yearsActive?.filterNotNull()
119115
)
120116

121-
model.spannedDescription =
122-
markdown.toMarkdown(model.generalDescription() + anilify(model.description))
123117
return model
124118
}
125119

app/src/main/kotlin/com/revolgenx/anilib/staff/ui/screen/StaffAboutScreen.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ package com.revolgenx.anilib.staff.ui.screen
22

33
import androidx.compose.runtime.Composable
44
import androidx.compose.runtime.LaunchedEffect
5+
import androidx.compose.runtime.remember
56
import androidx.compose.runtime.rememberCoroutineScope
7+
import com.revolgenx.anilib.common.ext.anilify
68
import com.revolgenx.anilib.common.ext.imageViewerScreen
79
import com.revolgenx.anilib.common.ext.localContext
810
import com.revolgenx.anilib.common.ext.localSnackbarHostState
11+
import com.revolgenx.anilib.common.ext.markdown
912
import com.revolgenx.anilib.common.ext.naText
1013
import com.revolgenx.anilib.common.ext.orZero
1114
import com.revolgenx.anilib.common.ext.showLoginMsg
@@ -35,14 +38,17 @@ fun StaffAboutScreen(
3538
}
3639

3740
ResourceScreen(viewModel = viewModel) { staff ->
41+
val description = remember(viewModel) {
42+
markdown.toMarkdown(staff.generalDescription(context) + anilify(staff.description))
43+
}
3844
EntityAboutScreenContent(
3945
name = staff.name?.full.naText(),
4046
alternative = staff.name?.alternativeText,
4147
imageUrl = staff.image?.image,
4248
favourites = staff.favourites.orZero(),
4349
isFavourite = staff.isFavourite.value,
4450
description = staff.description,
45-
spannedDescription = staff.spannedDescription,
51+
spannedDescription = description,
4652
onFavouriteClick = {
4753
if(isLoggedIn){
4854
viewModel.toggleFavorite()

i18n/src/main/res/values-ar/strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,8 @@ country of origin -->
508508
<string name="ads_every_other_day">كل يوم آخر</string>
509509
<string name="ads_every_week">كل اسبوع</string>
510510
<string name="ads_play_support_message">سيتم تشغيل إعلان قريبًا. يمكنك تخطيه في أي وقت، ولكن المشاهدة تساعد في دعم تطوير التطبيق.\nشكرًا على دعمك! 🙏</string>
511-
<string name="ads_support_the_app">ادعم التطبيق! \uD83D\uDC96</string>
512-
<string name="ads_support_button_message">\uD83D\uDCAC إذا كنت ترغب في دعم التطبيق، يمكنك مشاهدة الإعلانات بالضغط على الزر الموجود بالأسفل.</string>
511+
<string name="ads_support_the_app"> 💖 ادعم التطبيق!</string>
512+
<string name="ads_support_button_message">💬 إذا كنت ترغب في دعم التطبيق، يمكنك مشاهدة الإعلانات بالضغط على الزر الموجود بالأسفل.</string>
513513
<string name="datetime_days">ايام</string>
514514
<string name="datetime_hour">ساعات</string>
515515
<string name="datetime_min">دقائق</string>

i18n/src/main/res/values-de/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@
292292
<string name="category">Kategorie</string>
293293
<string name="rank">Rang</string>
294294
<string name="tag_name_percent">%1$s · %2$d%%</string>
295-
<string name="status_distribution_string">%1$s Benutzer %2$s</string>
295+
<string name="status_distribution_string">%1$s Benutzer\n%2$s</string>
296296
<string name="trailer">Trailer</string>
297297
<string name="airing_score_progression">Laufend Punkte Fortschritt</string>
298298
<string name="airing_watchers_progression">Laufend Zuschauer Fortschritt</string>

i18n/src/main/res/values-es/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@
280280
<string name="category">Categoría</string>
281281
<string name="rank">Rango</string>
282282
<string name="tag_name_percent">%1$s · %2$d%%</string>
283-
<string name="status_distribution_string">%1$s %2$s</string>
283+
<string name="status_distribution_string">%1$s Usuarios\n%2$s</string>
284284
<string name="trailer">Avance</string>
285285
<string name="airing_score_progression">Progreso de la puntuación en emisión</string>
286286
<string name="airing_watchers_progression">Progreso de usuarios viendo en emisión</string>

i18n/src/main/res/values-fr/strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,8 +504,8 @@ country of origin -->
504504
<string name="ads_every_other_day">Tous les deux jours</string>
505505
<string name="ads_every_week">Chaque semaine</string>
506506
<string name="ads_play_support_message">Une publicité est sur le point d\'être diffusée. Vous pouvez la passer à tout moment, mais la regarder permet de soutenir le développement de l\'application.\nMerci pour votre soutien ! 🙏</string>
507-
<string name="ads_support_the_app">Soutenez l\'application ! \uD83D\uDC96</string>
508-
<string name="ads_support_button_message">\uD83D\uDCAC Si vous souhaitez soutenir l\'application, vous pouvez regarder des publicités en appuyant sur le bouton ci-dessous.</string>
507+
<string name="ads_support_the_app">Soutenez l\'application ! 💖</string>
508+
<string name="ads_support_button_message">💬 Si vous souhaitez soutenir l\'application, vous pouvez regarder des publicités en appuyant sur le bouton ci-dessous.</string>
509509
<string name="datetime_days">Jour</string>
510510
<string name="datetime_hour">Heure</string>
511511
<string name="datetime_min">Min</string>

i18n/src/main/res/values-pl/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@
276276
<string name="category">"Kategoria"</string>
277277
<string name="rank">"Ranking"</string>
278278
<string name="tag_name_percent">"%1$s · %2$d%%"</string>
279-
<string name="status_distribution_string">"%1$s Użytkownik \n %2$s"</string>
279+
<string name="status_distribution_string">"%1$s Użytkownik\n%2$s"</string>
280280
<string name="trailer">"Zwiastun"</string>
281281
<string name="airing_score_progression">"Ocena wychodzących odcinków"</string>
282282
<string name="airing_watchers_progression">"Postęp oglądania wychodzących odcinków"</string>

0 commit comments

Comments
 (0)