Replace remaining Android-specific strings

Also renaming the helper composables so it's a bit easier to find/replace everything
in forks.
This commit is contained in:
arkon
2023-11-18 19:41:33 -05:00
parent 46e734fc8e
commit 0d1bced122
165 changed files with 1179 additions and 1167 deletions

View File

@@ -41,8 +41,8 @@ import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition
import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter
import tachiyomi.domain.chapter.service.calculateChapterGap
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.localizePlural
import tachiyomi.presentation.core.i18n.pluralStringResource
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.secondaryItemAlpha
@Composable
@@ -58,25 +58,25 @@ fun ChapterTransition(
when (transition) {
is ChapterTransition.Prev -> {
TransitionText(
topLabel = localize(MR.strings.transition_previous),
topLabel = stringResource(MR.strings.transition_previous),
topChapter = goingToChapter,
topChapterDownloaded = goingToChapterDownloaded,
bottomLabel = localize(MR.strings.transition_current),
bottomLabel = stringResource(MR.strings.transition_current),
bottomChapter = currChapter,
bottomChapterDownloaded = currChapterDownloaded,
fallbackLabel = localize(MR.strings.transition_no_previous),
fallbackLabel = stringResource(MR.strings.transition_no_previous),
chapterGap = calculateChapterGap(currChapter.toDomainChapter(), goingToChapter?.toDomainChapter()),
)
}
is ChapterTransition.Next -> {
TransitionText(
topLabel = localize(MR.strings.transition_finished),
topLabel = stringResource(MR.strings.transition_finished),
topChapter = currChapter,
topChapterDownloaded = currChapterDownloaded,
bottomLabel = localize(MR.strings.transition_next),
bottomLabel = stringResource(MR.strings.transition_next),
bottomChapter = goingToChapter,
bottomChapterDownloaded = goingToChapterDownloaded,
fallbackLabel = localize(MR.strings.transition_no_next),
fallbackLabel = stringResource(MR.strings.transition_no_next),
chapterGap = calculateChapterGap(goingToChapter?.toDomainChapter(), currChapter.toDomainChapter()),
)
}
@@ -191,7 +191,7 @@ private fun ChapterGapWarning(
)
Text(
text = localizePlural(MR.plurals.missing_chapters_warning, count = gapCount, gapCount),
text = pluralStringResource(MR.plurals.missing_chapters_warning, count = gapCount, gapCount),
style = MaterialTheme.typography.bodyMedium,
)
}
@@ -245,7 +245,7 @@ private fun ChapterText(
) {
Icon(
imageVector = Icons.Filled.CheckCircle,
contentDescription = localize(MR.strings.label_downloaded),
contentDescription = stringResource(MR.strings.label_downloaded),
)
},
),

View File

@@ -24,7 +24,7 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.SettingsIconGrid
import tachiyomi.presentation.core.components.material.IconToggleButton
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
private val ReaderOrientationsWithoutDefault = ReaderOrientation.entries - ReaderOrientation.DEFAULT
@@ -73,7 +73,7 @@ private fun DialogContent(
},
modifier = Modifier.fillMaxWidth(),
imageVector = ImageVector.vectorResource(mode.iconRes),
title = localize(mode.stringRes),
title = stringResource(mode.stringRes),
)
}
}

View File

@@ -22,7 +22,7 @@ import eu.kanade.presentation.components.AdaptiveSheet
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.ActionButton
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun ReaderPageActionsDialog(
@@ -42,13 +42,13 @@ fun ReaderPageActionsDialog(
) {
ActionButton(
modifier = Modifier.weight(1f),
title = localize(MR.strings.set_as_cover),
title = stringResource(MR.strings.set_as_cover),
icon = Icons.Outlined.Photo,
onClick = { showSetCoverDialog = true },
)
ActionButton(
modifier = Modifier.weight(1f),
title = localize(MR.strings.action_share),
title = stringResource(MR.strings.action_share),
icon = Icons.Outlined.Share,
onClick = {
onShare()
@@ -57,7 +57,7 @@ fun ReaderPageActionsDialog(
)
ActionButton(
modifier = Modifier.weight(1f),
title = localize(MR.strings.action_save),
title = stringResource(MR.strings.action_save),
icon = Icons.Outlined.Save,
onClick = {
onSave()
@@ -85,16 +85,16 @@ private fun SetCoverDialog(
) {
AlertDialog(
text = {
Text(localize(MR.strings.confirm_set_image_as_cover))
Text(stringResource(MR.strings.confirm_set_image_as_cover))
},
confirmButton = {
TextButton(onClick = onConfirm) {
Text(localize(MR.strings.action_ok))
Text(stringResource(MR.strings.action_ok))
}
},
dismissButton = {
TextButton(onClick = onDismiss) {
Text(localize(MR.strings.action_cancel))
Text(stringResource(MR.strings.action_cancel))
}
},
onDismissRequest = onDismiss,

View File

@@ -24,7 +24,7 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.SettingsIconGrid
import tachiyomi.presentation.core.components.material.IconToggleButton
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
private val ReadingModesWithoutDefault = ReadingMode.entries - ReadingMode.DEFAULT
@@ -69,7 +69,7 @@ private fun DialogContent(
},
modifier = Modifier.fillMaxWidth(),
imageVector = ImageVector.vectorResource(mode.iconRes),
title = localize(mode.stringRes),
title = stringResource(mode.stringRes),
)
}
}

View File

@@ -19,7 +19,7 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.reader.setting.ReaderOrientation
import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun BottomReaderBar(
@@ -43,28 +43,28 @@ fun BottomReaderBar(
IconButton(onClick = onClickReadingMode) {
Icon(
painter = painterResource(readingMode.iconRes),
contentDescription = localize(MR.strings.viewer),
contentDescription = stringResource(MR.strings.viewer),
)
}
IconButton(onClick = onClickOrientation) {
Icon(
painter = painterResource(orientation.iconRes),
contentDescription = localize(MR.strings.rotation_type),
contentDescription = stringResource(MR.strings.rotation_type),
)
}
IconButton(onClick = onClickCropBorder) {
Icon(
painter = painterResource(if (cropEnabled) R.drawable.ic_crop_24dp else R.drawable.ic_crop_off_24dp),
contentDescription = localize(MR.strings.pref_crop_borders),
contentDescription = stringResource(MR.strings.pref_crop_borders),
)
}
IconButton(onClick = onClickSettings) {
Icon(
imageVector = Icons.Outlined.Settings,
contentDescription = localize(MR.strings.action_settings),
contentDescription = stringResource(MR.strings.action_settings),
)
}
}

View File

@@ -29,7 +29,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.Viewer
import eu.kanade.tachiyomi.ui.reader.viewer.pager.R2LPagerViewer
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
private val animationSpec = tween<IntOffset>(200)
@@ -103,7 +103,7 @@ fun ReaderAppBars(
.apply {
add(
AppBar.Action(
title = localize(
title = stringResource(
if (bookmarked) {
MR.strings.action_remove_bookmark
} else {
@@ -121,7 +121,7 @@ fun ReaderAppBars(
onOpenInWebView?.let {
add(
AppBar.OverflowAction(
title = localize(MR.strings.action_open_in_web_view),
title = stringResource(MR.strings.action_open_in_web_view),
onClick = it,
),
)
@@ -129,7 +129,7 @@ fun ReaderAppBars(
onShare?.let {
add(
AppBar.OverflowAction(
title = localize(MR.strings.action_share),
title = stringResource(MR.strings.action_share),
onClick = it,
),
)

View File

@@ -34,7 +34,7 @@ import androidx.compose.ui.unit.LayoutDirection
import androidx.compose.ui.unit.dp
import eu.kanade.presentation.util.isTabletUi
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
import kotlin.math.roundToInt
@Composable
@@ -77,7 +77,7 @@ fun ChapterNavigator(
) {
Icon(
imageVector = Icons.Outlined.SkipPrevious,
contentDescription = localize(
contentDescription = stringResource(
if (isRtl) MR.strings.action_next_chapter else MR.strings.action_previous_chapter,
),
)
@@ -129,7 +129,7 @@ fun ChapterNavigator(
) {
Icon(
imageVector = Icons.Outlined.SkipNext,
contentDescription = localize(
contentDescription = stringResource(
if (isRtl) MR.strings.action_previous_chapter else MR.strings.action_next_chapter,
),
)

View File

@@ -21,7 +21,7 @@ import androidx.compose.ui.unit.dp
import eu.kanade.presentation.theme.TachiyomiTheme
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.SettingsItemsPaddings
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun ModeSelectionDialog(
@@ -40,7 +40,7 @@ fun ModeSelectionDialog(
) {
onUseDefault?.let {
OutlinedButton(onClick = it) {
Text(text = localize(MR.strings.action_revert_to_default))
Text(text = stringResource(MR.strings.action_revert_to_default))
}
}
@@ -57,7 +57,7 @@ fun ModeSelectionDialog(
imageVector = Icons.Outlined.Check,
contentDescription = null,
)
Text(text = localize(MR.strings.action_apply))
Text(text = stringResource(MR.strings.action_apply))
}
}
}

View File

@@ -16,7 +16,7 @@ import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.CheckboxItem
import tachiyomi.presentation.core.components.SettingsChipRow
import tachiyomi.presentation.core.components.SliderItem
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
@Composable
@@ -38,11 +38,11 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
),
)
}
}.map { localize(it) }
}.map { stringResource(it) }
val customBrightness by screenModel.preferences.customBrightness().collectAsState()
CheckboxItem(
label = localize(MR.strings.pref_custom_brightness),
label = stringResource(MR.strings.pref_custom_brightness),
pref = screenModel.preferences.customBrightness(),
)
@@ -55,7 +55,7 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
if (customBrightness) {
val customBrightnessValue by screenModel.preferences.customBrightnessValue().collectAsState()
SliderItem(
label = localize(MR.strings.pref_custom_brightness),
label = stringResource(MR.strings.pref_custom_brightness),
min = -75,
max = 100,
value = customBrightnessValue,
@@ -66,13 +66,13 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
val colorFilter by screenModel.preferences.colorFilter().collectAsState()
CheckboxItem(
label = localize(MR.strings.pref_custom_color_filter),
label = stringResource(MR.strings.pref_custom_color_filter),
pref = screenModel.preferences.colorFilter(),
)
if (colorFilter) {
val colorFilterValue by screenModel.preferences.colorFilterValue().collectAsState()
SliderItem(
label = localize(MR.strings.color_filter_r_value),
label = stringResource(MR.strings.color_filter_r_value),
max = 255,
value = colorFilterValue.red,
valueText = colorFilterValue.red.toString(),
@@ -83,7 +83,7 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
},
)
SliderItem(
label = localize(MR.strings.color_filter_g_value),
label = stringResource(MR.strings.color_filter_g_value),
max = 255,
value = colorFilterValue.green,
valueText = colorFilterValue.green.toString(),
@@ -94,7 +94,7 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
},
)
SliderItem(
label = localize(MR.strings.color_filter_b_value),
label = stringResource(MR.strings.color_filter_b_value),
max = 255,
value = colorFilterValue.blue,
valueText = colorFilterValue.blue.toString(),
@@ -105,7 +105,7 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
},
)
SliderItem(
label = localize(MR.strings.color_filter_a_value),
label = stringResource(MR.strings.color_filter_a_value),
max = 255,
value = colorFilterValue.alpha,
valueText = colorFilterValue.alpha.toString(),
@@ -129,11 +129,11 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
}
CheckboxItem(
label = localize(MR.strings.pref_grayscale),
label = stringResource(MR.strings.pref_grayscale),
pref = screenModel.preferences.grayscale(),
)
CheckboxItem(
label = localize(MR.strings.pref_inverted_colors),
label = stringResource(MR.strings.pref_inverted_colors),
pref = screenModel.preferences.invertedColors(),
)
}

View File

@@ -9,7 +9,7 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.CheckboxItem
import tachiyomi.presentation.core.components.SettingsChipRow
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
private val themes = listOf(
@@ -27,50 +27,50 @@ internal fun ColumnScope.GeneralPage(screenModel: ReaderSettingsScreenModel) {
FilterChip(
selected = readerTheme == value,
onClick = { screenModel.preferences.readerTheme().set(value) },
label = { Text(localize(labelRes)) },
label = { Text(stringResource(labelRes)) },
)
}
}
CheckboxItem(
label = localize(MR.strings.pref_show_page_number),
label = stringResource(MR.strings.pref_show_page_number),
pref = screenModel.preferences.showPageNumber(),
)
CheckboxItem(
label = localize(MR.strings.pref_fullscreen),
label = stringResource(MR.strings.pref_fullscreen),
pref = screenModel.preferences.fullscreen(),
)
if (screenModel.hasDisplayCutout) {
CheckboxItem(
label = localize(MR.strings.pref_cutout_short),
label = stringResource(MR.strings.pref_cutout_short),
pref = screenModel.preferences.cutoutShort(),
)
}
CheckboxItem(
label = localize(MR.strings.pref_keep_screen_on),
label = stringResource(MR.strings.pref_keep_screen_on),
pref = screenModel.preferences.keepScreenOn(),
)
CheckboxItem(
label = localize(MR.strings.pref_read_with_long_tap),
label = stringResource(MR.strings.pref_read_with_long_tap),
pref = screenModel.preferences.readWithLongTap(),
)
CheckboxItem(
label = localize(MR.strings.pref_always_show_chapter_transition),
label = stringResource(MR.strings.pref_always_show_chapter_transition),
pref = screenModel.preferences.alwaysShowChapterTransition(),
)
CheckboxItem(
label = localize(MR.strings.pref_page_transitions),
label = stringResource(MR.strings.pref_page_transitions),
pref = screenModel.preferences.pageTransitions(),
)
CheckboxItem(
label = localize(MR.strings.pref_flash_page),
label = stringResource(MR.strings.pref_flash_page),
pref = screenModel.preferences.flashOnPageChange(),
)
}

View File

@@ -17,7 +17,7 @@ import eu.kanade.presentation.components.TabbedDialogPaddings
import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun ReaderSettingsDialog(
@@ -27,9 +27,9 @@ fun ReaderSettingsDialog(
screenModel: ReaderSettingsScreenModel,
) {
val tabTitles = persistentListOf(
localize(MR.strings.pref_category_reading_mode),
localize(MR.strings.pref_category_general),
localize(MR.strings.custom_filter),
stringResource(MR.strings.pref_category_reading_mode),
stringResource(MR.strings.pref_category_general),
stringResource(MR.strings.custom_filter),
)
val pagerState = rememberPagerState { tabTitles.size }

View File

@@ -19,7 +19,7 @@ import tachiyomi.presentation.core.components.CheckboxItem
import tachiyomi.presentation.core.components.HeadingItem
import tachiyomi.presentation.core.components.SettingsChipRow
import tachiyomi.presentation.core.components.SliderItem
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
import java.text.NumberFormat
@@ -34,7 +34,7 @@ internal fun ColumnScope.ReadingModePage(screenModel: ReaderSettingsScreenModel)
FilterChip(
selected = it == readingMode,
onClick = { screenModel.onChangeReadingMode(it) },
label = { Text(localize(it.stringRes)) },
label = { Text(stringResource(it.stringRes)) },
)
}
}
@@ -45,7 +45,7 @@ internal fun ColumnScope.ReadingModePage(screenModel: ReaderSettingsScreenModel)
FilterChip(
selected = it == orientation,
onClick = { screenModel.onChangeOrientation(it) },
label = { Text(localize(it.stringRes)) },
label = { Text(stringResource(it.stringRes)) },
)
}
}
@@ -77,7 +77,7 @@ private fun ColumnScope.PagerViewerSettings(screenModel: ReaderSettingsScreenMod
FilterChip(
selected = imageScaleType == index + 1,
onClick = { screenModel.preferences.imageScaleType().set(index + 1) },
label = { Text(localize(it)) },
label = { Text(stringResource(it)) },
)
}
}
@@ -88,48 +88,48 @@ private fun ColumnScope.PagerViewerSettings(screenModel: ReaderSettingsScreenMod
FilterChip(
selected = zoomStart == index + 1,
onClick = { screenModel.preferences.zoomStart().set(index + 1) },
label = { Text(localize(it)) },
label = { Text(stringResource(it)) },
)
}
}
CheckboxItem(
label = localize(MR.strings.pref_crop_borders),
label = stringResource(MR.strings.pref_crop_borders),
pref = screenModel.preferences.cropBorders(),
)
CheckboxItem(
label = localize(MR.strings.pref_landscape_zoom),
label = stringResource(MR.strings.pref_landscape_zoom),
pref = screenModel.preferences.landscapeZoom(),
)
CheckboxItem(
label = localize(MR.strings.pref_navigate_pan),
label = stringResource(MR.strings.pref_navigate_pan),
pref = screenModel.preferences.navigateToPan(),
)
val dualPageSplitPaged by screenModel.preferences.dualPageSplitPaged().collectAsState()
CheckboxItem(
label = localize(MR.strings.pref_dual_page_split),
label = stringResource(MR.strings.pref_dual_page_split),
pref = screenModel.preferences.dualPageSplitPaged(),
)
if (dualPageSplitPaged) {
CheckboxItem(
label = localize(MR.strings.pref_dual_page_invert),
label = stringResource(MR.strings.pref_dual_page_invert),
pref = screenModel.preferences.dualPageInvertPaged(),
)
}
val dualPageRotateToFit by screenModel.preferences.dualPageRotateToFit().collectAsState()
CheckboxItem(
label = localize(MR.strings.pref_page_rotate),
label = stringResource(MR.strings.pref_page_rotate),
pref = screenModel.preferences.dualPageRotateToFit(),
)
if (dualPageRotateToFit) {
CheckboxItem(
label = localize(MR.strings.pref_page_rotate_invert),
label = stringResource(MR.strings.pref_page_rotate_invert),
pref = screenModel.preferences.dualPageRotateToFitInvert(),
)
}
@@ -152,7 +152,7 @@ private fun ColumnScope.WebtoonViewerSettings(screenModel: ReaderSettingsScreenM
val webtoonSidePadding by screenModel.preferences.webtoonSidePadding().collectAsState()
SliderItem(
label = localize(MR.strings.pref_webtoon_side_padding),
label = stringResource(MR.strings.pref_webtoon_side_padding),
min = ReaderPreferences.WEBTOON_PADDING_MIN,
max = ReaderPreferences.WEBTOON_PADDING_MAX,
value = webtoonSidePadding,
@@ -163,25 +163,25 @@ private fun ColumnScope.WebtoonViewerSettings(screenModel: ReaderSettingsScreenM
)
CheckboxItem(
label = localize(MR.strings.pref_crop_borders),
label = stringResource(MR.strings.pref_crop_borders),
pref = screenModel.preferences.cropBordersWebtoon(),
)
val dualPageSplitWebtoon by screenModel.preferences.dualPageSplitWebtoon().collectAsState()
CheckboxItem(
label = localize(MR.strings.pref_dual_page_split),
label = stringResource(MR.strings.pref_dual_page_split),
pref = screenModel.preferences.dualPageSplitWebtoon(),
)
if (dualPageSplitWebtoon) {
CheckboxItem(
label = localize(MR.strings.pref_dual_page_invert),
label = stringResource(MR.strings.pref_dual_page_invert),
pref = screenModel.preferences.dualPageInvertWebtoon(),
)
}
CheckboxItem(
label = localize(MR.strings.pref_double_tap_zoom),
label = stringResource(MR.strings.pref_double_tap_zoom),
pref = screenModel.preferences.webtoonDoubleTapZoomEnabled(),
)
}
@@ -198,7 +198,7 @@ private fun ColumnScope.TapZonesItems(
FilterChip(
selected = selected == index,
onClick = { onSelect(index) },
label = { Text(localize(it)) },
label = { Text(stringResource(it)) },
)
}
}
@@ -209,7 +209,7 @@ private fun ColumnScope.TapZonesItems(
FilterChip(
selected = it == invertMode,
onClick = { onSelectInvertMode(it) },
label = { Text(localize(it.titleRes)) },
label = { Text(stringResource(it.titleRes)) },
)
}
}