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
@@ -25,20 +25,20 @@ import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import eu.kanade.domain.manga.model.downloadedFilter
import eu.kanade.domain.manga.model.forceDownloaded
import eu.kanade.presentation.components.TabbedDialog
import eu.kanade.presentation.components.TabbedDialogPaddings
import eu.kanade.tachiyomi.R
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.core.preference.TriState
import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.LabeledCheckbox
import tachiyomi.presentation.core.components.RadioItem
import tachiyomi.presentation.core.components.SortItem
import tachiyomi.presentation.core.components.TriStateItem
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.theme.active
@Composable
@@ -66,20 +66,20 @@ fun ChapterSettingsDialog(
TabbedDialog(
onDismissRequest = onDismissRequest,
tabTitles = persistentListOf(
stringResource(R.string.action_filter),
stringResource(R.string.action_sort),
stringResource(R.string.action_display),
localize(MR.strings.action_filter),
localize(MR.strings.action_sort),
localize(MR.strings.action_display),
),
tabOverflowMenuContent = { closeMenu ->
DropdownMenuItem(
text = { Text(stringResource(R.string.set_chapter_settings_as_default)) },
text = { Text(localize(MR.strings.set_chapter_settings_as_default)) },
onClick = {
showSetAsDefaultDialog = true
closeMenu()
},
)
DropdownMenuItem(
text = { Text(stringResource(R.string.action_reset)) },
text = { Text(localize(MR.strings.action_reset)) },
onClick = {
onResetToDefault()
closeMenu()
@@ -136,17 +136,17 @@ private fun ColumnScope.FilterPage(
onScanlatorFilterClicked: (() -> Unit),
) {
TriStateItem(
label = stringResource(R.string.label_downloaded),
label = localize(MR.strings.label_downloaded),
state = downloadFilter,
onClick = onDownloadFilterChanged,
)
TriStateItem(
label = stringResource(R.string.action_filter_unread),
label = localize(MR.strings.action_filter_unread),
state = unreadFilter,
onClick = onUnreadFilterChanged,
)
TriStateItem(
label = stringResource(R.string.action_filter_bookmarked),
label = localize(MR.strings.action_filter_bookmarked),
state = bookmarkedFilter,
onClick = onBookmarkedFilterChanged,
)
@@ -179,7 +179,7 @@ fun ScanlatorFilterItem(
},
)
Text(
text = stringResource(R.string.scanlator),
text = localize(MR.strings.scanlator),
style = MaterialTheme.typography.bodyMedium,
)
}
@@ -192,13 +192,13 @@ private fun ColumnScope.SortPage(
onItemSelected: (Long) -> Unit,
) {
listOf(
R.string.sort_by_source to Manga.CHAPTER_SORTING_SOURCE,
R.string.sort_by_number to Manga.CHAPTER_SORTING_NUMBER,
R.string.sort_by_upload_date to Manga.CHAPTER_SORTING_UPLOAD_DATE,
R.string.action_sort_alpha to Manga.CHAPTER_SORTING_ALPHABET,
MR.strings.sort_by_source to Manga.CHAPTER_SORTING_SOURCE,
MR.strings.sort_by_number to Manga.CHAPTER_SORTING_NUMBER,
MR.strings.sort_by_upload_date to Manga.CHAPTER_SORTING_UPLOAD_DATE,
MR.strings.action_sort_alpha to Manga.CHAPTER_SORTING_ALPHABET,
).map { (titleRes, mode) ->
SortItem(
label = stringResource(titleRes),
label = localize(titleRes),
sortDescending = sortDescending.takeIf { sortingMode == mode },
onClick = { onItemSelected(mode) },
)
@@ -211,11 +211,11 @@ private fun ColumnScope.DisplayPage(
onItemSelected: (Long) -> Unit,
) {
listOf(
R.string.show_title to Manga.CHAPTER_DISPLAY_NAME,
R.string.show_chapter_number to Manga.CHAPTER_DISPLAY_NUMBER,
MR.strings.show_title to Manga.CHAPTER_DISPLAY_NAME,
MR.strings.show_chapter_number to Manga.CHAPTER_DISPLAY_NUMBER,
).map { (titleRes, mode) ->
RadioItem(
label = stringResource(titleRes),
label = localize(titleRes),
selected = displayMode == mode,
onClick = { onItemSelected(mode) },
)
@@ -231,15 +231,15 @@ private fun SetAsDefaultDialog(
AlertDialog(
onDismissRequest = onDismissRequest,
title = { Text(text = stringResource(R.string.chapter_settings)) },
title = { Text(text = localize(MR.strings.chapter_settings)) },
text = {
Column(
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
Text(text = stringResource(R.string.confirm_set_chapter_settings))
Text(text = localize(MR.strings.confirm_set_chapter_settings))
LabeledCheckbox(
label = stringResource(R.string.also_set_chapter_settings_for_library),
label = localize(MR.strings.also_set_chapter_settings_for_library),
checked = optionalChecked,
onCheckedChange = { optionalChecked = it },
)
@@ -247,7 +247,7 @@ private fun SetAsDefaultDialog(
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = localize(MR.strings.action_cancel))
}
},
confirmButton = {
@@ -257,7 +257,7 @@ private fun SetAsDefaultDialog(
onDismissRequest()
},
) {
Text(text = stringResource(R.string.action_ok))
Text(text = localize(MR.strings.action_ok))
}
},
)