Migrate to multiplatform string resources (#10147)

* Migrate to multiplatform string resources

* Move plurals translations into separate files

* Fix lint check on generated files
This commit is contained in:
arkon
2023-11-18 13:54:56 -05:00
committed by GitHub
parent c39ae21f4a
commit 46e734fc8e
340 changed files with 5741 additions and 6292 deletions
@@ -9,10 +9,11 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.res.stringResource
import eu.kanade.tachiyomi.R
import dev.icerock.moko.resources.StringResource
import tachiyomi.core.preference.CheckboxState
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.LabeledCheckbox
import tachiyomi.presentation.core.i18n.localize
@Composable
fun DeleteLibraryMangaDialog(
@@ -22,10 +23,10 @@ fun DeleteLibraryMangaDialog(
) {
var list by remember {
mutableStateOf(
buildList<CheckboxState.State<Int>> {
add(CheckboxState.State.None(R.string.manga_from_library))
buildList<CheckboxState.State<StringResource>> {
add(CheckboxState.State.None(MR.strings.manga_from_library))
if (!containsLocalManga) {
add(CheckboxState.State.None(R.string.downloaded_chapters))
add(CheckboxState.State.None(MR.strings.downloaded_chapters))
}
},
)
@@ -34,7 +35,7 @@ fun DeleteLibraryMangaDialog(
onDismissRequest = onDismissRequest,
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = localize(MR.strings.action_cancel))
}
},
confirmButton = {
@@ -48,23 +49,23 @@ fun DeleteLibraryMangaDialog(
)
},
) {
Text(text = stringResource(R.string.action_ok))
Text(text = localize(MR.strings.action_ok))
}
},
title = {
Text(text = stringResource(R.string.action_remove))
Text(text = localize(MR.strings.action_remove))
},
text = {
Column {
list.forEach { state ->
LabeledCheckbox(
label = stringResource(state.value),
label = localize(state.value),
checked = state.isChecked,
onCheckedChange = {
val index = list.indexOf(state)
if (index != -1) {
val mutableList = list.toMutableList()
mutableList[index] = state.next() as CheckboxState.State<Int>
mutableList[index] = state.next() as CheckboxState.State<StringResource>
list = mutableList.toList()
}
},