Replace remaining Android-specific strings

Also renaming the helper composables so it's a bit easier to find/replace everything
in forks.

(cherry picked from commit 0d1bced1226878336f8156671ae0c224c02f2604)

# Conflicts:
#	app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt
#	app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt
#	app/src/main/java/eu/kanade/presentation/browse/SourcesScreen.kt
#	app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceToolbar.kt
#	app/src/main/java/eu/kanade/presentation/category/components/CategoryDialogs.kt
#	app/src/main/java/eu/kanade/presentation/library/LibrarySettingsDialog.kt
#	app/src/main/java/eu/kanade/presentation/manga/components/MangaBottomActionMenu.kt
#	app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt
#	app/src/main/java/eu/kanade/presentation/more/MoreScreen.kt
#	app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt
#	app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsBrowseScreen.kt
#	app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt
#	app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsMainScreen.kt
#	app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt
#	app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsSecurityScreen.kt
#	app/src/main/java/eu/kanade/presentation/more/settings/screen/about/AboutScreen.kt
#	app/src/main/java/eu/kanade/presentation/more/settings/screen/advanced/ClearDatabaseScreen.kt
#	app/src/main/java/eu/kanade/presentation/more/settings/screen/data/CreateBackupScreen.kt
#	app/src/main/java/eu/kanade/presentation/reader/ReaderPageActionsDialog.kt
#	app/src/main/java/eu/kanade/presentation/reader/appbars/BottomReaderBar.kt
#	app/src/main/java/eu/kanade/presentation/reader/appbars/ReaderAppBars.kt
#	app/src/main/java/eu/kanade/presentation/reader/components/ChapterNavigator.kt
#	app/src/main/java/eu/kanade/presentation/reader/settings/GeneralSettingsPage.kt
#	app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt
#	app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt
#	app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt
#	app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/BrowseTab.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateDialog.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SourceSearchScreen.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrateSourceTab.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourcesTab.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreen.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceFilterDialog.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/history/HistoryTab.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/stats/StatsScreen.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/updates/UpdatesTab.kt
This commit is contained in:
arkon 2023-11-18 19:41:33 -05:00 committed by Jobobby04
parent 1eccf9fad8
commit 82098460ff
123 changed files with 708 additions and 701 deletions

View File

@ -28,13 +28,13 @@ import exh.source.isEhBasedSource
import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.domain.library.model.LibraryDisplayMode import tachiyomi.domain.library.model.LibraryDisplayMode
import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.Manga
import tachiyomi.domain.source.model.StubSource import tachiyomi.domain.source.model.StubSource
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.screens.EmptyScreenAction import tachiyomi.presentation.core.screens.EmptyScreenAction
import tachiyomi.presentation.core.screens.LoadingScreen import tachiyomi.presentation.core.screens.LoadingScreen
@ -72,7 +72,7 @@ fun BrowseSourceContent(
if (mangaList.itemCount > 0 && errorState != null && errorState is LoadState.Error) { if (mangaList.itemCount > 0 && errorState != null && errorState is LoadState.Error) {
val result = snackbarHostState.showSnackbar( val result = snackbarHostState.showSnackbar(
message = getErrorMessage(errorState), message = getErrorMessage(errorState),
actionLabel = context.localize(MR.strings.action_retry), actionLabel = context.stringResource(MR.strings.action_retry),
duration = SnackbarDuration.Indefinite, duration = SnackbarDuration.Indefinite,
) )
when (result) { when (result) {
@ -192,7 +192,7 @@ internal fun MissingSourceScreen(
}, },
) { paddingValues -> ) { paddingValues ->
EmptyScreen( EmptyScreen(
message = localize(MR.strings.source_not_installed, source.toString()), message = stringResource(MR.strings.source_not_installed, source.toString()),
modifier = Modifier.padding(paddingValues), modifier = Modifier.padding(paddingValues),
) )
} }

View File

@ -13,7 +13,7 @@ import eu.kanade.tachiyomi.ui.browse.extension.ExtensionFilterState
import eu.kanade.tachiyomi.util.system.LocaleHelper import eu.kanade.tachiyomi.util.system.LocaleHelper
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen import tachiyomi.presentation.core.screens.EmptyScreen
@Composable @Composable
@ -25,7 +25,7 @@ fun ExtensionFilterScreen(
Scaffold( Scaffold(
topBar = { scrollBehavior -> topBar = { scrollBehavior ->
AppBar( AppBar(
title = localize(MR.strings.label_extensions), title = stringResource(MR.strings.label_extensions),
navigateUp = navigateUp, navigateUp = navigateUp,
scrollBehavior = scrollBehavior, scrollBehavior = scrollBehavior,
) )

View File

@ -36,7 +36,7 @@ import tachiyomi.presentation.core.components.ScrollbarLazyColumn
import tachiyomi.presentation.core.components.Scroller.STICKY_HEADER_KEY_PREFIX import tachiyomi.presentation.core.components.Scroller.STICKY_HEADER_KEY_PREFIX
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.components.material.topSmallPaddingValues import tachiyomi.presentation.core.components.material.topSmallPaddingValues
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.screens.LoadingScreen import tachiyomi.presentation.core.screens.LoadingScreen
import tachiyomi.presentation.core.theme.header import tachiyomi.presentation.core.theme.header
@ -106,7 +106,7 @@ private fun MigrateSourceList(
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
) { ) {
Text( Text(
text = localize(MR.strings.migration_selection_prompt), text = stringResource(MR.strings.migration_selection_prompt),
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
style = MaterialTheme.typography.header, style = MaterialTheme.typography.header,
) )
@ -115,11 +115,11 @@ private fun MigrateSourceList(
when (sortingMode) { when (sortingMode) {
SetMigrateSorting.Mode.ALPHABETICAL -> Icon( SetMigrateSorting.Mode.ALPHABETICAL -> Icon(
Icons.Outlined.SortByAlpha, Icons.Outlined.SortByAlpha,
contentDescription = localize(MR.strings.action_sort_alpha), contentDescription = stringResource(MR.strings.action_sort_alpha),
) )
SetMigrateSorting.Mode.TOTAL -> Icon( SetMigrateSorting.Mode.TOTAL -> Icon(
Icons.Outlined.Numbers, Icons.Outlined.Numbers,
contentDescription = localize(MR.strings.action_sort_count), contentDescription = stringResource(MR.strings.action_sort_count),
) )
} }
} }
@ -127,11 +127,11 @@ private fun MigrateSourceList(
when (sortingDirection) { when (sortingDirection) {
SetMigrateSorting.Direction.ASCENDING -> Icon( SetMigrateSorting.Direction.ASCENDING -> Icon(
Icons.Outlined.ArrowUpward, Icons.Outlined.ArrowUpward,
contentDescription = localize(MR.strings.action_asc), contentDescription = stringResource(MR.strings.action_asc),
) )
SetMigrateSorting.Direction.DESCENDING -> Icon( SetMigrateSorting.Direction.DESCENDING -> Icon(
Icons.Outlined.ArrowDownward, Icons.Outlined.ArrowDownward,
contentDescription = localize(MR.strings.action_desc), contentDescription = stringResource(MR.strings.action_desc),
) )
} }
} }
@ -216,7 +216,7 @@ private fun MigrateSourceItem(
if (source.isStub) { if (source.isStub) {
Text( Text(
modifier = Modifier.secondaryItemAlpha(), modifier = Modifier.secondaryItemAlpha(),
text = localize(MR.strings.not_installed), text = stringResource(MR.strings.not_installed),
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.bodySmall,

View File

@ -17,7 +17,7 @@ import tachiyomi.domain.source.model.Source
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.FastScrollLazyColumn import tachiyomi.presentation.core.components.FastScrollLazyColumn
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen import tachiyomi.presentation.core.screens.EmptyScreen
@Composable @Composable
@ -33,7 +33,7 @@ fun SourcesFilterScreen(
Scaffold( Scaffold(
topBar = { scrollBehavior -> topBar = { scrollBehavior ->
AppBar( AppBar(
title = localize(MR.strings.label_sources), title = stringResource(MR.strings.label_sources),
navigateUp = navigateUp, navigateUp = navigateUp,
scrollBehavior = scrollBehavior, scrollBehavior = scrollBehavior,
) )

View File

@ -19,7 +19,7 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun RemoveMangaDialog( fun RemoveMangaDialog(
@ -31,7 +31,7 @@ fun RemoveMangaDialog(
onDismissRequest = onDismissRequest, onDismissRequest = onDismissRequest,
dismissButton = { dismissButton = {
TextButton(onClick = onDismissRequest) { TextButton(onClick = onDismissRequest) {
Text(text = localize(MR.strings.action_cancel)) Text(text = stringResource(MR.strings.action_cancel))
} }
}, },
confirmButton = { confirmButton = {
@ -41,14 +41,14 @@ fun RemoveMangaDialog(
onConfirm() onConfirm()
}, },
) { ) {
Text(text = localize(MR.strings.action_remove)) Text(text = stringResource(MR.strings.action_remove))
} }
}, },
title = { title = {
Text(text = localize(MR.strings.are_you_sure)) Text(text = stringResource(MR.strings.are_you_sure))
}, },
text = { text = {
Text(text = localize(MR.strings.remove_manga, mangaToRemove.title)) Text(text = stringResource(MR.strings.remove_manga, mangaToRemove.title))
}, },
) )
} }

View File

@ -21,7 +21,7 @@ import tachiyomi.domain.manga.model.MangaCover
import tachiyomi.domain.manga.model.asMangaCover import tachiyomi.domain.manga.model.asMangaCover
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun GlobalSearchCardRow( fun GlobalSearchCardRow(
@ -78,7 +78,7 @@ private fun MangaItem(
@Composable @Composable
private fun EmptyResultItem() { private fun EmptyResultItem() {
Text( Text(
text = localize(MR.strings.no_results_found), text = stringResource(MR.strings.no_results_found),
modifier = Modifier modifier = Modifier
.padding( .padding(
horizontal = MaterialTheme.padding.medium, horizontal = MaterialTheme.padding.medium,

View File

@ -13,7 +13,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.ArrowForward import androidx.compose.material.icons.automirrored.outlined.ArrowForward
import androidx.compose.material.icons.outlined.ArrowForward
import androidx.compose.material.icons.outlined.Error import androidx.compose.material.icons.outlined.Error
import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
@ -27,7 +26,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun GlobalSearchResultItem( fun GlobalSearchResultItem(
@ -112,7 +111,7 @@ fun GlobalSearchErrorResultItem(message: String?) {
Icon(imageVector = Icons.Outlined.Error, contentDescription = null) Icon(imageVector = Icons.Outlined.Error, contentDescription = null)
Spacer(Modifier.height(4.dp)) Spacer(Modifier.height(4.dp))
Text( Text(
text = message ?: localize(MR.strings.unknown_error), text = message ?: stringResource(MR.strings.unknown_error),
textAlign = TextAlign.Center, textAlign = TextAlign.Center,
) )
} }

View File

@ -30,7 +30,7 @@ import eu.kanade.presentation.components.SearchToolbar
import eu.kanade.tachiyomi.ui.browse.source.globalsearch.SourceFilter import eu.kanade.tachiyomi.ui.browse.source.globalsearch.SourceFilter
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun GlobalSearchToolbar( fun GlobalSearchToolbar(
@ -85,7 +85,7 @@ fun GlobalSearchToolbar(
) )
}, },
label = { label = {
Text(text = localize(MR.strings.pinned_sources)) Text(text = stringResource(MR.strings.pinned_sources))
}, },
) )
FilterChip( FilterChip(
@ -100,7 +100,7 @@ fun GlobalSearchToolbar(
) )
}, },
label = { label = {
Text(text = localize(MR.strings.all)) Text(text = stringResource(MR.strings.all))
}, },
) )
@ -118,7 +118,7 @@ fun GlobalSearchToolbar(
) )
}, },
label = { label = {
Text(text = localize(MR.strings.has_results)) Text(text = stringResource(MR.strings.has_results))
}, },
) )
} }

View File

@ -2,20 +2,20 @@ package eu.kanade.presentation.category
import android.content.Context import android.content.Context
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.domain.category.model.Category import tachiyomi.domain.category.model.Category
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
val Category.visualName: String val Category.visualName: String
@Composable @Composable
get() = when { get() = when {
isSystemCategory -> localize(MR.strings.label_default) isSystemCategory -> stringResource(MR.strings.label_default)
else -> name else -> name
} }
fun Category.visualName(context: Context): String = fun Category.visualName(context: Context): String =
when { when {
isSystemCategory -> context.localize(MR.strings.label_default) isSystemCategory -> context.stringResource(MR.strings.label_default)
else -> name else -> name
} }

View File

@ -23,7 +23,7 @@ import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.components.material.topSmallPaddingValues import tachiyomi.presentation.core.components.material.topSmallPaddingValues
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.util.plus import tachiyomi.presentation.core.util.plus
@ -42,13 +42,13 @@ fun CategoryScreen(
Scaffold( Scaffold(
topBar = { scrollBehavior -> topBar = { scrollBehavior ->
AppBar( AppBar(
title = localize(MR.strings.action_edit_categories), title = stringResource(MR.strings.action_edit_categories),
navigateUp = navigateUp, navigateUp = navigateUp,
actions = { actions = {
AppBarActions( AppBarActions(
persistentListOf( persistentListOf(
AppBar.Action( AppBar.Action(
title = localize(MR.strings.action_sort), title = stringResource(MR.strings.action_sort),
icon = Icons.Outlined.SortByAlpha, icon = Icons.Outlined.SortByAlpha,
onClick = onClickSortAlphabetically, onClick = onClickSortAlphabetically,
), ),

View File

@ -8,7 +8,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.ExtendedFloatingActionButton import tachiyomi.presentation.core.components.material.ExtendedFloatingActionButton
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.isScrolledToEnd import tachiyomi.presentation.core.util.isScrolledToEnd
import tachiyomi.presentation.core.util.isScrollingUp import tachiyomi.presentation.core.util.isScrollingUp
@ -18,7 +18,7 @@ fun CategoryFloatingActionButton(
onCreate: () -> Unit, onCreate: () -> Unit,
) { ) {
ExtendedFloatingActionButton( ExtendedFloatingActionButton(
text = { Text(text = localize(MR.strings.action_add)) }, text = { Text(text = stringResource(MR.strings.action_add)) },
icon = { Icon(imageVector = Icons.Outlined.Add, contentDescription = null) }, icon = { Icon(imageVector = Icons.Outlined.Add, contentDescription = null) },
onClick = onCreate, onClick = onCreate,
expanded = lazyListState.isScrollingUp() || lazyListState.isScrolledToEnd(), expanded = lazyListState.isScrollingUp() || lazyListState.isScrolledToEnd(),

View File

@ -11,7 +11,6 @@ import androidx.compose.material.icons.outlined.ArrowDropDown
import androidx.compose.material.icons.outlined.ArrowDropUp import androidx.compose.material.icons.outlined.ArrowDropUp
import androidx.compose.material.icons.outlined.Delete import androidx.compose.material.icons.outlined.Delete
import androidx.compose.material.icons.outlined.Edit import androidx.compose.material.icons.outlined.Edit
import androidx.compose.material.icons.outlined.Label
import androidx.compose.material3.ElevatedCard import androidx.compose.material3.ElevatedCard
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton import androidx.compose.material3.IconButton
@ -23,7 +22,7 @@ import androidx.compose.ui.Modifier
import tachiyomi.domain.category.model.Category import tachiyomi.domain.category.model.Category
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun CategoryListItem( fun CategoryListItem(
@ -74,11 +73,11 @@ fun CategoryListItem(
IconButton(onClick = onRename) { IconButton(onClick = onRename) {
Icon( Icon(
imageVector = Icons.Outlined.Edit, imageVector = Icons.Outlined.Edit,
contentDescription = localize(MR.strings.action_rename_category), contentDescription = stringResource(MR.strings.action_rename_category),
) )
} }
IconButton(onClick = onDelete) { IconButton(onClick = onDelete) {
Icon(imageVector = Icons.Outlined.Delete, contentDescription = localize(MR.strings.action_delete)) Icon(imageVector = Icons.Outlined.Delete, contentDescription = stringResource(MR.strings.action_delete))
} }
} }
} }

View File

@ -50,10 +50,9 @@ import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import eu.kanade.tachiyomi.R
import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.ImmutableList
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.clearFocusOnSoftKeyboardHide import tachiyomi.presentation.core.util.clearFocusOnSoftKeyboardHide
import tachiyomi.presentation.core.util.runOnEnterKeyPressed import tachiyomi.presentation.core.util.runOnEnterKeyPressed
import tachiyomi.presentation.core.util.secondaryItemAlpha import tachiyomi.presentation.core.util.secondaryItemAlpha
@ -135,7 +134,7 @@ fun AppBar(
IconButton(onClick = onCancelActionMode) { IconButton(onClick = onCancelActionMode) {
Icon( Icon(
imageVector = Icons.Outlined.Close, imageVector = Icons.Outlined.Close,
contentDescription = localize(MR.strings.action_cancel), contentDescription = stringResource(MR.strings.action_cancel),
) )
} }
} else { } else {
@ -220,7 +219,7 @@ fun AppBarActions(
positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(), positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
tooltip = { tooltip = {
PlainTooltip { PlainTooltip {
Text(stringResource(R.string.abc_action_menu_overflow_description)) Text(stringResource(MR.strings.action_menu_overflow_description))
} }
}, },
state = rememberTooltipState(), state = rememberTooltipState(),
@ -230,7 +229,7 @@ fun AppBarActions(
) { ) {
Icon( Icon(
Icons.Outlined.MoreVert, Icons.Outlined.MoreVert,
contentDescription = stringResource(R.string.abc_action_menu_overflow_description), contentDescription = stringResource(MR.strings.action_menu_overflow_description),
) )
} }
} }
@ -319,7 +318,7 @@ fun SearchToolbar(
placeholder = { placeholder = {
Text( Text(
modifier = Modifier.secondaryItemAlpha(), modifier = Modifier.secondaryItemAlpha(),
text = (placeholderText ?: localize(MR.strings.action_search_hint)), text = (placeholderText ?: stringResource(MR.strings.action_search_hint)),
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
style = MaterialTheme.typography.titleMedium.copy( style = MaterialTheme.typography.titleMedium.copy(
@ -344,7 +343,7 @@ fun SearchToolbar(
positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(), positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
tooltip = { tooltip = {
PlainTooltip { PlainTooltip {
Text(localize(MR.strings.action_search)) Text(stringResource(MR.strings.action_search))
} }
}, },
state = rememberTooltipState(), state = rememberTooltipState(),
@ -354,7 +353,7 @@ fun SearchToolbar(
) { ) {
Icon( Icon(
Icons.Outlined.Search, Icons.Outlined.Search,
contentDescription = localize(MR.strings.action_search), contentDescription = stringResource(MR.strings.action_search),
) )
} }
} }
@ -363,7 +362,7 @@ fun SearchToolbar(
positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(), positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
tooltip = { tooltip = {
PlainTooltip { PlainTooltip {
Text(localize(MR.strings.action_reset)) Text(stringResource(MR.strings.action_reset))
} }
}, },
state = rememberTooltipState(), state = rememberTooltipState(),
@ -376,7 +375,7 @@ fun SearchToolbar(
) { ) {
Icon( Icon(
Icons.Outlined.Close, Icons.Outlined.Close,
contentDescription = localize(MR.strings.action_reset), contentDescription = stringResource(MR.strings.action_reset),
) )
} }
} }
@ -396,7 +395,7 @@ fun UpIcon(navigationIcon: ImageVector? = null) {
?: Icons.AutoMirrored.Outlined.ArrowBack ?: Icons.AutoMirrored.Outlined.ArrowBack
Icon( Icon(
imageVector = icon, imageVector = icon,
contentDescription = stringResource(R.string.abc_action_bar_up_description), contentDescription = stringResource(MR.strings.action_bar_up_description),
) )
} }

View File

@ -32,7 +32,7 @@ import androidx.compose.ui.util.fastMap
import androidx.compose.ui.util.fastMaxBy import androidx.compose.ui.util.fastMaxBy
import dev.icerock.moko.resources.StringResource import dev.icerock.moko.resources.StringResource
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
val DownloadedOnlyBannerBackgroundColor val DownloadedOnlyBannerBackgroundColor
@Composable get() = MaterialTheme.colorScheme.tertiary @Composable get() = MaterialTheme.colorScheme.tertiary
@ -47,7 +47,7 @@ fun WarningBanner(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
Text( Text(
text = localize(textRes), text = stringResource(textRes),
modifier = modifier modifier = modifier
.fillMaxWidth() .fillMaxWidth()
.background(MaterialTheme.colorScheme.error) .background(MaterialTheme.colorScheme.error)
@ -127,7 +127,7 @@ fun AppStateBanners(
@Composable @Composable
private fun DownloadedOnlyModeBanner(modifier: Modifier = Modifier) { private fun DownloadedOnlyModeBanner(modifier: Modifier = Modifier) {
Text( Text(
text = localize(MR.strings.label_downloaded_only), text = stringResource(MR.strings.label_downloaded_only),
modifier = Modifier modifier = Modifier
.background(DownloadedOnlyBannerBackgroundColor) .background(DownloadedOnlyBannerBackgroundColor)
.fillMaxWidth() .fillMaxWidth()
@ -142,7 +142,7 @@ private fun DownloadedOnlyModeBanner(modifier: Modifier = Modifier) {
@Composable @Composable
private fun IncognitoModeBanner(modifier: Modifier = Modifier) { private fun IncognitoModeBanner(modifier: Modifier = Modifier) {
Text( Text(
text = localize(MR.strings.pref_incognito_mode), text = stringResource(MR.strings.pref_incognito_mode),
modifier = Modifier modifier = Modifier
.background(IncognitoModeBannerBackgroundColor) .background(IncognitoModeBannerBackgroundColor)
.fillMaxWidth() .fillMaxWidth()
@ -173,7 +173,7 @@ private fun IndexingDownloadBanner(modifier: Modifier = Modifier) {
) )
Spacer(modifier = Modifier.width(8.dp)) Spacer(modifier = Modifier.width(8.dp))
Text( Text(
text = localize(MR.strings.download_notifier_cache_renewal), text = stringResource(MR.strings.download_notifier_cache_renewal),
color = MaterialTheme.colorScheme.onSecondary, color = MaterialTheme.colorScheme.onSecondary,
textAlign = TextAlign.Center, textAlign = TextAlign.Center,
style = MaterialTheme.typography.labelMedium, style = MaterialTheme.typography.labelMedium,

View File

@ -5,8 +5,8 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import eu.kanade.presentation.manga.DownloadAction import eu.kanade.presentation.manga.DownloadAction
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.pluralStringResource
import tachiyomi.presentation.core.i18n.localizePlural import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun DownloadDropdownMenu( fun DownloadDropdownMenu(
@ -19,11 +19,11 @@ fun DownloadDropdownMenu(
onDismissRequest = onDismissRequest, onDismissRequest = onDismissRequest,
) { ) {
listOfNotNull( listOfNotNull(
DownloadAction.NEXT_1_CHAPTER to localizePlural(MR.plurals.download_amount, 1, 1), DownloadAction.NEXT_1_CHAPTER to pluralStringResource(MR.plurals.download_amount, 1, 1),
DownloadAction.NEXT_5_CHAPTERS to localizePlural(MR.plurals.download_amount, 5, 5), DownloadAction.NEXT_5_CHAPTERS to pluralStringResource(MR.plurals.download_amount, 5, 5),
DownloadAction.NEXT_10_CHAPTERS to localizePlural(MR.plurals.download_amount, 10, 10), DownloadAction.NEXT_10_CHAPTERS to pluralStringResource(MR.plurals.download_amount, 10, 10),
DownloadAction.NEXT_25_CHAPTERS to localizePlural(MR.plurals.download_amount, 25, 25), DownloadAction.NEXT_25_CHAPTERS to pluralStringResource(MR.plurals.download_amount, 25, 25),
DownloadAction.UNREAD_CHAPTERS to localize(MR.strings.download_unread), DownloadAction.UNREAD_CHAPTERS to stringResource(MR.strings.download_unread),
).map { (downloadAction, string) -> ).map { (downloadAction, string) ->
DropdownMenuItem( DropdownMenuItem(
text = { Text(text = string) }, text = { Text(text = string) },

View File

@ -19,7 +19,7 @@ import androidx.compose.ui.unit.DpOffset
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.PopupProperties import androidx.compose.ui.window.PopupProperties
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import androidx.compose.material3.DropdownMenu as ComposeDropdownMenu import androidx.compose.material3.DropdownMenu as ComposeDropdownMenu
@Composable @Composable
@ -54,13 +54,13 @@ fun RadioMenuItem(
if (isChecked) { if (isChecked) {
Icon( Icon(
imageVector = Icons.Outlined.RadioButtonChecked, imageVector = Icons.Outlined.RadioButtonChecked,
contentDescription = localize(MR.strings.selected), contentDescription = stringResource(MR.strings.selected),
tint = MaterialTheme.colorScheme.primary, tint = MaterialTheme.colorScheme.primary,
) )
} else { } else {
Icon( Icon(
imageVector = Icons.Outlined.RadioButtonUnchecked, imageVector = Icons.Outlined.RadioButtonUnchecked,
contentDescription = localize(MR.strings.not_selected), contentDescription = stringResource(MR.strings.not_selected),
) )
} }
}, },

View File

@ -31,7 +31,7 @@ import kotlinx.coroutines.launch
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.HorizontalPager import tachiyomi.presentation.core.components.HorizontalPager
import tachiyomi.presentation.core.components.material.TabText import tachiyomi.presentation.core.components.material.TabText
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
object TabbedDialogPaddings { object TabbedDialogPaddings {
val Horizontal = 24.dp val Horizontal = 24.dp
@ -94,7 +94,7 @@ private fun MoreMenu(
IconButton(onClick = { expanded = true }) { IconButton(onClick = { expanded = true }) {
Icon( Icon(
imageVector = Icons.Default.MoreVert, imageVector = Icons.Default.MoreVert,
contentDescription = localize(MR.strings.label_more), contentDescription = stringResource(MR.strings.label_more),
) )
} }
DropdownMenu( DropdownMenu(

View File

@ -26,7 +26,7 @@ import kotlinx.coroutines.launch
import tachiyomi.presentation.core.components.HorizontalPager import tachiyomi.presentation.core.components.HorizontalPager
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.components.material.TabText import tachiyomi.presentation.core.components.material.TabText
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun TabbedScreen( fun TabbedScreen(
@ -52,7 +52,7 @@ fun TabbedScreen(
val searchEnabled = tab.searchEnabled val searchEnabled = tab.searchEnabled
SearchToolbar( SearchToolbar(
titleContent = { AppBarTitle(localize(titleRes)) }, titleContent = { AppBarTitle(stringResource(titleRes)) },
searchEnabled = searchEnabled, searchEnabled = searchEnabled,
searchQuery = if (searchEnabled) searchQuery else null, searchQuery = if (searchEnabled) searchQuery else null,
onChangeSearchQuery = onChangeSearchQuery, onChangeSearchQuery = onChangeSearchQuery,
@ -75,7 +75,7 @@ fun TabbedScreen(
Tab( Tab(
selected = state.currentPage == index, selected = state.currentPage == index,
onClick = { scope.launch { state.animateScrollToPage(index) } }, onClick = { scope.launch { state.animateScrollToPage(index) } },
text = { TabText(text = localize(tab.titleRes), badgeCount = tab.badgeNumber) }, text = { TabText(text = stringResource(tab.titleRes), badgeCount = tab.badgeNumber) },
unselectedContentColor = MaterialTheme.colorScheme.onSurface, unselectedContentColor = MaterialTheme.colorScheme.onSurface,
) )
} }

View File

@ -19,7 +19,7 @@ import eu.kanade.tachiyomi.util.CrashLogUtil
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.InfoScreen import tachiyomi.presentation.core.screens.InfoScreen
@Composable @Composable
@ -32,15 +32,15 @@ fun CrashScreen(
InfoScreen( InfoScreen(
icon = Icons.Outlined.BugReport, icon = Icons.Outlined.BugReport,
headingText = localize(MR.strings.crash_screen_title), headingText = stringResource(MR.strings.crash_screen_title),
subtitleText = localize(MR.strings.crash_screen_description, localize(MR.strings.app_name)), subtitleText = stringResource(MR.strings.crash_screen_description, stringResource(MR.strings.app_name)),
acceptText = localize(MR.strings.pref_dump_crash_logs), acceptText = stringResource(MR.strings.pref_dump_crash_logs),
onAcceptClick = { onAcceptClick = {
scope.launch { scope.launch {
CrashLogUtil(context).dumpLogs() CrashLogUtil(context).dumpLogs()
} }
}, },
rejectText = localize(MR.strings.crash_screen_restart_application), rejectText = stringResource(MR.strings.crash_screen_restart_application),
onRejectClick = onRestartClick, onRejectClick = onRestartClick,
) { ) {
Box( Box(

View File

@ -27,7 +27,7 @@ import tachiyomi.domain.history.model.HistoryWithRelations
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.FastScrollLazyColumn import tachiyomi.presentation.core.components.FastScrollLazyColumn
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.screens.LoadingScreen import tachiyomi.presentation.core.screens.LoadingScreen
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
@ -47,14 +47,14 @@ fun HistoryScreen(
Scaffold( Scaffold(
topBar = { scrollBehavior -> topBar = { scrollBehavior ->
SearchToolbar( SearchToolbar(
titleContent = { AppBarTitle(localize(MR.strings.history)) }, titleContent = { AppBarTitle(stringResource(MR.strings.history)) },
searchQuery = state.searchQuery, searchQuery = state.searchQuery,
onChangeSearchQuery = onSearchQueryChange, onChangeSearchQuery = onSearchQueryChange,
actions = { actions = {
AppBarActions( AppBarActions(
persistentListOf( persistentListOf(
AppBar.Action( AppBar.Action(
title = localize(MR.strings.pref_clear_history), title = stringResource(MR.strings.pref_clear_history),
icon = Icons.Outlined.DeleteSweep, icon = Icons.Outlined.DeleteSweep,
onClick = { onClick = {
onDialogChange(HistoryScreenModel.Dialog.DeleteAll) onDialogChange(HistoryScreenModel.Dialog.DeleteAll)

View File

@ -15,7 +15,7 @@ import androidx.compose.ui.unit.dp
import eu.kanade.presentation.theme.TachiyomiTheme import eu.kanade.presentation.theme.TachiyomiTheme
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.LabeledCheckbox import tachiyomi.presentation.core.components.LabeledCheckbox
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun HistoryDeleteDialog( fun HistoryDeleteDialog(
@ -26,16 +26,16 @@ fun HistoryDeleteDialog(
AlertDialog( AlertDialog(
title = { title = {
Text(text = localize(MR.strings.action_remove)) Text(text = stringResource(MR.strings.action_remove))
}, },
text = { text = {
Column( Column(
verticalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(8.dp),
) { ) {
Text(text = localize(MR.strings.dialog_with_checkbox_remove_description)) Text(text = stringResource(MR.strings.dialog_with_checkbox_remove_description))
LabeledCheckbox( LabeledCheckbox(
label = localize(MR.strings.dialog_with_checkbox_reset), label = stringResource(MR.strings.dialog_with_checkbox_reset),
checked = removeEverything, checked = removeEverything,
onCheckedChange = { removeEverything = it }, onCheckedChange = { removeEverything = it },
) )
@ -47,12 +47,12 @@ fun HistoryDeleteDialog(
onDelete(removeEverything) onDelete(removeEverything)
onDismissRequest() onDismissRequest()
}) { }) {
Text(text = localize(MR.strings.action_remove)) Text(text = stringResource(MR.strings.action_remove))
} }
}, },
dismissButton = { dismissButton = {
TextButton(onClick = onDismissRequest) { TextButton(onClick = onDismissRequest) {
Text(text = localize(MR.strings.action_cancel)) Text(text = stringResource(MR.strings.action_cancel))
} }
}, },
) )
@ -65,10 +65,10 @@ fun HistoryDeleteAllDialog(
) { ) {
AlertDialog( AlertDialog(
title = { title = {
Text(text = localize(MR.strings.action_remove_everything)) Text(text = stringResource(MR.strings.action_remove_everything))
}, },
text = { text = {
Text(text = localize(MR.strings.clear_history_confirmation)) Text(text = stringResource(MR.strings.clear_history_confirmation))
}, },
onDismissRequest = onDismissRequest, onDismissRequest = onDismissRequest,
confirmButton = { confirmButton = {
@ -76,12 +76,12 @@ fun HistoryDeleteAllDialog(
onDelete() onDelete()
onDismissRequest() onDismissRequest()
}) { }) {
Text(text = localize(MR.strings.action_ok)) Text(text = stringResource(MR.strings.action_ok))
} }
}, },
dismissButton = { dismissButton = {
TextButton(onClick = onDismissRequest) { TextButton(onClick = onDismissRequest) {
Text(text = localize(MR.strings.action_cancel)) Text(text = stringResource(MR.strings.action_cancel))
} }
}, },
) )

View File

@ -29,7 +29,7 @@ import eu.kanade.tachiyomi.util.lang.toTimestampString
import tachiyomi.domain.history.model.HistoryWithRelations import tachiyomi.domain.history.model.HistoryWithRelations
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
private val HistoryItemHeight = 96.dp private val HistoryItemHeight = 96.dp
@ -69,7 +69,7 @@ fun HistoryItem(
val readAt = remember { history.readAt?.toTimestampString() ?: "" } val readAt = remember { history.readAt?.toTimestampString() ?: "" }
Text( Text(
text = if (history.chapterNumber > -1) { text = if (history.chapterNumber > -1) {
localize( stringResource(
MR.strings.recent_manga_time, MR.strings.recent_manga_time,
formatChapterNumber(history.chapterNumber), formatChapterNumber(history.chapterNumber),
readAt, readAt,
@ -85,7 +85,7 @@ fun HistoryItem(
IconButton(onClick = onClickDelete) { IconButton(onClick = onClickDelete) {
Icon( Icon(
imageVector = Icons.Outlined.Delete, imageVector = Icons.Outlined.Delete,
contentDescription = localize(MR.strings.action_delete), contentDescription = stringResource(MR.strings.action_delete),
tint = MaterialTheme.colorScheme.onSurface, tint = MaterialTheme.colorScheme.onSurface,
) )
} }

View File

@ -13,7 +13,7 @@ import dev.icerock.moko.resources.StringResource
import tachiyomi.core.preference.CheckboxState import tachiyomi.core.preference.CheckboxState
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.LabeledCheckbox import tachiyomi.presentation.core.components.LabeledCheckbox
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun DeleteLibraryMangaDialog( fun DeleteLibraryMangaDialog(
@ -35,7 +35,7 @@ fun DeleteLibraryMangaDialog(
onDismissRequest = onDismissRequest, onDismissRequest = onDismissRequest,
dismissButton = { dismissButton = {
TextButton(onClick = onDismissRequest) { TextButton(onClick = onDismissRequest) {
Text(text = localize(MR.strings.action_cancel)) Text(text = stringResource(MR.strings.action_cancel))
} }
}, },
confirmButton = { confirmButton = {
@ -49,17 +49,17 @@ fun DeleteLibraryMangaDialog(
) )
}, },
) { ) {
Text(text = localize(MR.strings.action_ok)) Text(text = stringResource(MR.strings.action_ok))
} }
}, },
title = { title = {
Text(text = localize(MR.strings.action_remove)) Text(text = stringResource(MR.strings.action_remove))
}, },
text = { text = {
Column { Column {
list.forEach { state -> list.forEach { state ->
LabeledCheckbox( LabeledCheckbox(
label = localize(state.value), label = stringResource(state.value),
checked = state.isChecked, checked = state.isChecked,
onCheckedChange = { onCheckedChange = {
val index = list.indexOf(state) val index = list.indexOf(state)

View File

@ -40,7 +40,7 @@ import androidx.compose.ui.unit.sp
import eu.kanade.presentation.manga.components.MangaCover import eu.kanade.presentation.manga.components.MangaCover
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.BadgeGroup import tachiyomi.presentation.core.components.BadgeGroup
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.selectedBackground import tachiyomi.presentation.core.util.selectedBackground
object CommonMangaItemDefaults { object CommonMangaItemDefaults {
@ -378,7 +378,7 @@ private fun ContinueReadingButton(
) { ) {
Icon( Icon(
imageVector = Icons.Filled.PlayArrow, imageVector = Icons.Filled.PlayArrow,
contentDescription = localize(MR.strings.action_resume), contentDescription = stringResource(MR.strings.action_resume),
modifier = Modifier.size(16.dp), modifier = Modifier.size(16.dp),
) )
} }

View File

@ -6,7 +6,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.zIndex import androidx.compose.ui.zIndex
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
internal fun GlobalSearchItem( internal fun GlobalSearchItem(
@ -19,7 +19,7 @@ internal fun GlobalSearchItem(
onClick = onClick, onClick = onClick,
) { ) {
Text( Text(
text = localize(MR.strings.action_global_search_query, searchQuery), text = stringResource(MR.strings.action_global_search_query, searchQuery),
modifier = Modifier.zIndex(99f), modifier = Modifier.zIndex(99f),
) )
} }

View File

@ -22,7 +22,7 @@ import eu.kanade.presentation.components.SearchToolbar
import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.Pill import tachiyomi.presentation.core.components.Pill
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.theme.active import tachiyomi.presentation.core.theme.active
@Composable @Composable
@ -107,21 +107,21 @@ private fun LibraryRegularToolbar(
AppBarActions( AppBarActions(
persistentListOf( persistentListOf(
AppBar.Action( AppBar.Action(
title = localize(MR.strings.action_filter), title = stringResource(MR.strings.action_filter),
icon = Icons.Outlined.FilterList, icon = Icons.Outlined.FilterList,
iconTint = filterTint, iconTint = filterTint,
onClick = onClickFilter, onClick = onClickFilter,
), ),
AppBar.OverflowAction( AppBar.OverflowAction(
title = localize(MR.strings.action_update_library), title = stringResource(MR.strings.action_update_library),
onClick = onClickGlobalUpdate, onClick = onClickGlobalUpdate,
), ),
AppBar.OverflowAction( AppBar.OverflowAction(
title = localize(MR.strings.action_update_category), title = stringResource(MR.strings.action_update_category),
onClick = onClickRefresh, onClick = onClickRefresh,
), ),
AppBar.OverflowAction( AppBar.OverflowAction(
title = localize(MR.strings.action_open_random_manga), title = stringResource(MR.strings.action_open_random_manga),
onClick = onClickOpenRandomManga, onClick = onClickOpenRandomManga,
), ),
@ -156,12 +156,12 @@ private fun LibrarySelectionToolbar(
AppBarActions( AppBarActions(
persistentListOf( persistentListOf(
AppBar.Action( AppBar.Action(
title = localize(MR.strings.action_select_all), title = stringResource(MR.strings.action_select_all),
icon = Icons.Outlined.SelectAll, icon = Icons.Outlined.SelectAll,
onClick = onClickSelectAll, onClick = onClickSelectAll,
), ),
AppBar.Action( AppBar.Action(
title = localize(MR.strings.action_select_inverse), title = stringResource(MR.strings.action_select_inverse),
icon = Icons.Outlined.FlipToBack, icon = Icons.Outlined.FlipToBack,
onClick = onClickInvertSelection, onClick = onClickInvertSelection,
), ),

View File

@ -38,7 +38,7 @@ import tachiyomi.presentation.core.components.LabeledCheckbox
import tachiyomi.presentation.core.components.RadioItem import tachiyomi.presentation.core.components.RadioItem
import tachiyomi.presentation.core.components.SortItem import tachiyomi.presentation.core.components.SortItem
import tachiyomi.presentation.core.components.TriStateItem import tachiyomi.presentation.core.components.TriStateItem
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.theme.active import tachiyomi.presentation.core.theme.active
@Composable @Composable
@ -66,20 +66,20 @@ fun ChapterSettingsDialog(
TabbedDialog( TabbedDialog(
onDismissRequest = onDismissRequest, onDismissRequest = onDismissRequest,
tabTitles = persistentListOf( tabTitles = persistentListOf(
localize(MR.strings.action_filter), stringResource(MR.strings.action_filter),
localize(MR.strings.action_sort), stringResource(MR.strings.action_sort),
localize(MR.strings.action_display), stringResource(MR.strings.action_display),
), ),
tabOverflowMenuContent = { closeMenu -> tabOverflowMenuContent = { closeMenu ->
DropdownMenuItem( DropdownMenuItem(
text = { Text(localize(MR.strings.set_chapter_settings_as_default)) }, text = { Text(stringResource(MR.strings.set_chapter_settings_as_default)) },
onClick = { onClick = {
showSetAsDefaultDialog = true showSetAsDefaultDialog = true
closeMenu() closeMenu()
}, },
) )
DropdownMenuItem( DropdownMenuItem(
text = { Text(localize(MR.strings.action_reset)) }, text = { Text(stringResource(MR.strings.action_reset)) },
onClick = { onClick = {
onResetToDefault() onResetToDefault()
closeMenu() closeMenu()
@ -136,17 +136,17 @@ private fun ColumnScope.FilterPage(
onScanlatorFilterClicked: (() -> Unit), onScanlatorFilterClicked: (() -> Unit),
) { ) {
TriStateItem( TriStateItem(
label = localize(MR.strings.label_downloaded), label = stringResource(MR.strings.label_downloaded),
state = downloadFilter, state = downloadFilter,
onClick = onDownloadFilterChanged, onClick = onDownloadFilterChanged,
) )
TriStateItem( TriStateItem(
label = localize(MR.strings.action_filter_unread), label = stringResource(MR.strings.action_filter_unread),
state = unreadFilter, state = unreadFilter,
onClick = onUnreadFilterChanged, onClick = onUnreadFilterChanged,
) )
TriStateItem( TriStateItem(
label = localize(MR.strings.action_filter_bookmarked), label = stringResource(MR.strings.action_filter_bookmarked),
state = bookmarkedFilter, state = bookmarkedFilter,
onClick = onBookmarkedFilterChanged, onClick = onBookmarkedFilterChanged,
) )
@ -179,7 +179,7 @@ fun ScanlatorFilterItem(
}, },
) )
Text( Text(
text = localize(MR.strings.scanlator), text = stringResource(MR.strings.scanlator),
style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyMedium,
) )
} }
@ -198,7 +198,7 @@ private fun ColumnScope.SortPage(
MR.strings.action_sort_alpha to Manga.CHAPTER_SORTING_ALPHABET, MR.strings.action_sort_alpha to Manga.CHAPTER_SORTING_ALPHABET,
).map { (titleRes, mode) -> ).map { (titleRes, mode) ->
SortItem( SortItem(
label = localize(titleRes), label = stringResource(titleRes),
sortDescending = sortDescending.takeIf { sortingMode == mode }, sortDescending = sortDescending.takeIf { sortingMode == mode },
onClick = { onItemSelected(mode) }, onClick = { onItemSelected(mode) },
) )
@ -215,7 +215,7 @@ private fun ColumnScope.DisplayPage(
MR.strings.show_chapter_number to Manga.CHAPTER_DISPLAY_NUMBER, MR.strings.show_chapter_number to Manga.CHAPTER_DISPLAY_NUMBER,
).map { (titleRes, mode) -> ).map { (titleRes, mode) ->
RadioItem( RadioItem(
label = localize(titleRes), label = stringResource(titleRes),
selected = displayMode == mode, selected = displayMode == mode,
onClick = { onItemSelected(mode) }, onClick = { onItemSelected(mode) },
) )
@ -231,15 +231,15 @@ private fun SetAsDefaultDialog(
AlertDialog( AlertDialog(
onDismissRequest = onDismissRequest, onDismissRequest = onDismissRequest,
title = { Text(text = localize(MR.strings.chapter_settings)) }, title = { Text(text = stringResource(MR.strings.chapter_settings)) },
text = { text = {
Column( Column(
verticalArrangement = Arrangement.spacedBy(12.dp), verticalArrangement = Arrangement.spacedBy(12.dp),
) { ) {
Text(text = localize(MR.strings.confirm_set_chapter_settings)) Text(text = stringResource(MR.strings.confirm_set_chapter_settings))
LabeledCheckbox( LabeledCheckbox(
label = localize(MR.strings.also_set_chapter_settings_for_library), label = stringResource(MR.strings.also_set_chapter_settings_for_library),
checked = optionalChecked, checked = optionalChecked,
onCheckedChange = { optionalChecked = it }, onCheckedChange = { optionalChecked = it },
) )
@ -247,7 +247,7 @@ private fun SetAsDefaultDialog(
}, },
dismissButton = { dismissButton = {
TextButton(onClick = onDismissRequest) { TextButton(onClick = onDismissRequest) {
Text(text = localize(MR.strings.action_cancel)) Text(text = stringResource(MR.strings.action_cancel))
} }
}, },
confirmButton = { confirmButton = {
@ -257,7 +257,7 @@ private fun SetAsDefaultDialog(
onDismissRequest() onDismissRequest()
}, },
) { ) {
Text(text = localize(MR.strings.action_ok)) Text(text = stringResource(MR.strings.action_ok))
} }
}, },
) )

View File

@ -10,7 +10,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun DuplicateMangaDialog( fun DuplicateMangaDialog(
@ -21,10 +21,10 @@ fun DuplicateMangaDialog(
AlertDialog( AlertDialog(
onDismissRequest = onDismissRequest, onDismissRequest = onDismissRequest,
title = { title = {
Text(text = localize(MR.strings.are_you_sure)) Text(text = stringResource(MR.strings.are_you_sure))
}, },
text = { text = {
Text(text = localize(MR.strings.confirm_add_duplicate_manga)) Text(text = stringResource(MR.strings.confirm_add_duplicate_manga))
}, },
confirmButton = { confirmButton = {
FlowRow( FlowRow(
@ -36,13 +36,13 @@ fun DuplicateMangaDialog(
onOpenManga() onOpenManga()
}, },
) { ) {
Text(text = localize(MR.strings.action_show_manga)) Text(text = stringResource(MR.strings.action_show_manga))
} }
Spacer(modifier = Modifier.weight(1f)) Spacer(modifier = Modifier.weight(1f))
TextButton(onClick = onDismissRequest) { TextButton(onClick = onDismissRequest) {
Text(text = localize(MR.strings.action_cancel)) Text(text = stringResource(MR.strings.action_cancel))
} }
TextButton( TextButton(
onClick = { onClick = {
@ -50,7 +50,7 @@ fun DuplicateMangaDialog(
onConfirm() onConfirm()
}, },
) { ) {
Text(text = localize(MR.strings.action_add)) Text(text = stringResource(MR.strings.action_add))
} }
} }
}, },

View File

@ -98,7 +98,7 @@ import tachiyomi.presentation.core.components.VerticalFastScroller
import tachiyomi.presentation.core.components.material.ExtendedFloatingActionButton import tachiyomi.presentation.core.components.material.ExtendedFloatingActionButton
import tachiyomi.presentation.core.components.material.PullRefresh import tachiyomi.presentation.core.components.material.PullRefresh
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.isScrolledToEnd import tachiyomi.presentation.core.util.isScrolledToEnd
import tachiyomi.presentation.core.util.isScrollingUp import tachiyomi.presentation.core.util.isScrollingUp
import java.text.DateFormat import java.text.DateFormat
@ -422,7 +422,9 @@ private fun MangaScreenSmallImpl(
val isReading = remember(state.chapters) { val isReading = remember(state.chapters) {
state.chapters.fastAny { it.chapter.read } state.chapters.fastAny { it.chapter.read }
} }
Text(text = localize(if (isReading) MR.strings.action_resume else MR.strings.action_start)) Text(
text = stringResource(if (isReading) MR.strings.action_resume else MR.strings.action_start),
)
}, },
icon = { Icon(imageVector = Icons.Filled.PlayArrow, contentDescription = null) }, icon = { Icon(imageVector = Icons.Filled.PlayArrow, contentDescription = null) },
onClick = onContinueReading, onClick = onContinueReading,
@ -758,7 +760,9 @@ fun MangaScreenLargeImpl(
state.chapters.fastAny { it.chapter.read } state.chapters.fastAny { it.chapter.read }
} }
Text( Text(
text = localize(if (isReading) MR.strings.action_resume else MR.strings.action_start), text = stringResource(
if (isReading) MR.strings.action_resume else MR.strings.action_start,
),
) )
}, },
icon = { Icon(imageVector = Icons.Filled.PlayArrow, contentDescription = null) }, icon = { Icon(imageVector = Icons.Filled.PlayArrow, contentDescription = null) },
@ -977,7 +981,7 @@ private fun LazyListScope.sharedChapterItems(
is ChapterList.Item -> { is ChapterList.Item -> {
MangaChapterListItem( MangaChapterListItem(
title = if (manga.displayMode == Manga.CHAPTER_DISPLAY_NUMBER) { title = if (manga.displayMode == Manga.CHAPTER_DISPLAY_NUMBER) {
localize( stringResource(
MR.strings.display_mode_chapter, MR.strings.display_mode_chapter,
formatChapterNumber(item.chapter.chapterNumber), formatChapterNumber(item.chapter.chapterNumber),
) )
@ -1002,7 +1006,7 @@ private fun LazyListScope.sharedChapterItems(
readProgress = item.chapter.lastPageRead readProgress = item.chapter.lastPageRead
.takeIf { /* SY --> */(!item.chapter.read || alwaysShowReadingProgress)/* SY <-- */ && it > 0L } .takeIf { /* SY --> */(!item.chapter.read || alwaysShowReadingProgress)/* SY <-- */ && it > 0L }
?.let { ?.let {
localize( stringResource(
MR.strings.chapter_progress, MR.strings.chapter_progress,
it + 1, it + 1,
) )

View File

@ -36,7 +36,7 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.download.model.Download import eu.kanade.tachiyomi.data.download.model.Download
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.IconButtonTokens import tachiyomi.presentation.core.components.material.IconButtonTokens
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.secondaryItemAlpha import tachiyomi.presentation.core.util.secondaryItemAlpha
enum class ChapterDownloadAction { enum class ChapterDownloadAction {
@ -99,7 +99,7 @@ private fun NotDownloadedIndicator(
) { ) {
Icon( Icon(
painter = painterResource(R.drawable.ic_download_chapter_24dp), painter = painterResource(R.drawable.ic_download_chapter_24dp),
contentDescription = localize(MR.strings.manga_download), contentDescription = stringResource(MR.strings.manga_download),
modifier = Modifier.size(IndicatorSize), modifier = Modifier.size(IndicatorSize),
tint = MaterialTheme.colorScheme.onSurfaceVariant, tint = MaterialTheme.colorScheme.onSurfaceVariant,
) )
@ -156,14 +156,14 @@ private fun DownloadingIndicator(
} }
DropdownMenu(expanded = isMenuExpanded, onDismissRequest = { isMenuExpanded = false }) { DropdownMenu(expanded = isMenuExpanded, onDismissRequest = { isMenuExpanded = false }) {
DropdownMenuItem( DropdownMenuItem(
text = { Text(text = localize(MR.strings.action_start_downloading_now)) }, text = { Text(text = stringResource(MR.strings.action_start_downloading_now)) },
onClick = { onClick = {
onClick(ChapterDownloadAction.START_NOW) onClick(ChapterDownloadAction.START_NOW)
isMenuExpanded = false isMenuExpanded = false
}, },
) )
DropdownMenuItem( DropdownMenuItem(
text = { Text(text = localize(MR.strings.action_cancel)) }, text = { Text(text = stringResource(MR.strings.action_cancel)) },
onClick = { onClick = {
onClick(ChapterDownloadAction.CANCEL) onClick(ChapterDownloadAction.CANCEL)
isMenuExpanded = false isMenuExpanded = false
@ -204,7 +204,7 @@ private fun DownloadedIndicator(
) )
DropdownMenu(expanded = isMenuExpanded, onDismissRequest = { isMenuExpanded = false }) { DropdownMenu(expanded = isMenuExpanded, onDismissRequest = { isMenuExpanded = false }) {
DropdownMenuItem( DropdownMenuItem(
text = { Text(text = localize(MR.strings.action_delete)) }, text = { Text(text = stringResource(MR.strings.action_delete)) },
onClick = { onClick = {
onClick(ChapterDownloadAction.DELETE) onClick(ChapterDownloadAction.DELETE)
isMenuExpanded = false isMenuExpanded = false
@ -232,7 +232,7 @@ private fun ErrorIndicator(
) { ) {
Icon( Icon(
imageVector = Icons.Outlined.ErrorOutline, imageVector = Icons.Outlined.ErrorOutline,
contentDescription = localize(MR.strings.chapter_error), contentDescription = stringResource(MR.strings.chapter_error),
modifier = Modifier.size(IndicatorSize), modifier = Modifier.size(IndicatorSize),
tint = MaterialTheme.colorScheme.error, tint = MaterialTheme.colorScheme.error,
) )

View File

@ -13,8 +13,8 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.SecondaryItemAlpha import tachiyomi.presentation.core.components.material.SecondaryItemAlpha
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.pluralStringResource
import tachiyomi.presentation.core.i18n.localizePlural import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun ChapterHeader( fun ChapterHeader(
@ -35,9 +35,9 @@ fun ChapterHeader(
) { ) {
Text( Text(
text = if (chapterCount == null) { text = if (chapterCount == null) {
localize(MR.strings.chapters) stringResource(MR.strings.chapters)
} else { } else {
localizePlural(MR.plurals.manga_num_chapters, count = chapterCount, chapterCount) pluralStringResource(MR.plurals.manga_num_chapters, count = chapterCount, chapterCount)
}, },
style = MaterialTheme.typography.titleMedium, style = MaterialTheme.typography.titleMedium,
color = MaterialTheme.colorScheme.onBackground, color = MaterialTheme.colorScheme.onBackground,
@ -54,7 +54,7 @@ private fun MissingChaptersWarning(count: Int) {
} }
Text( Text(
text = localizePlural(MR.plurals.missing_chapters, count = count, count), text = pluralStringResource(MR.plurals.missing_chapters, count = count, count),
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.bodySmall,

View File

@ -52,7 +52,7 @@ import tachiyomi.domain.library.service.LibraryPreferences
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.ReadItemAlpha import tachiyomi.presentation.core.components.material.ReadItemAlpha
import tachiyomi.presentation.core.components.material.SecondaryItemAlpha import tachiyomi.presentation.core.components.material.SecondaryItemAlpha
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.selectedBackground import tachiyomi.presentation.core.util.selectedBackground
import kotlin.math.absoluteValue import kotlin.math.absoluteValue
@ -146,7 +146,7 @@ fun MangaChapterListItem(
if (!read) { if (!read) {
Icon( Icon(
imageVector = Icons.Filled.Circle, imageVector = Icons.Filled.Circle,
contentDescription = localize(MR.strings.unread), contentDescription = stringResource(MR.strings.unread),
modifier = Modifier modifier = Modifier
.height(8.dp) .height(8.dp)
.padding(end = 4.dp), .padding(end = 4.dp),
@ -156,7 +156,7 @@ fun MangaChapterListItem(
if (bookmark) { if (bookmark) {
Icon( Icon(
imageVector = Icons.Filled.Bookmark, imageVector = Icons.Filled.Bookmark,
contentDescription = localize(MR.strings.action_filter_bookmarked), contentDescription = stringResource(MR.strings.action_filter_bookmarked),
modifier = Modifier modifier = Modifier
.sizeIn(maxHeight = with(LocalDensity.current) { textHeight.toDp() - 2.dp }), .sizeIn(maxHeight = with(LocalDensity.current) { textHeight.toDp() - 2.dp }),
tint = MaterialTheme.colorScheme.primary, tint = MaterialTheme.colorScheme.primary,

View File

@ -51,7 +51,7 @@ import kotlinx.collections.immutable.persistentListOf
import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.clickableNoIndication import tachiyomi.presentation.core.util.clickableNoIndication
@Composable @Composable
@ -85,7 +85,7 @@ fun MangaCoverDialog(
IconButton(onClick = onDismissRequest) { IconButton(onClick = onDismissRequest) {
Icon( Icon(
imageVector = Icons.Outlined.Close, imageVector = Icons.Outlined.Close,
contentDescription = localize(MR.strings.action_close), contentDescription = stringResource(MR.strings.action_close),
) )
} }
} }
@ -94,12 +94,12 @@ fun MangaCoverDialog(
AppBarActions( AppBarActions(
actions = persistentListOf( actions = persistentListOf(
AppBar.Action( AppBar.Action(
title = localize(MR.strings.action_share), title = stringResource(MR.strings.action_share),
icon = Icons.Outlined.Share, icon = Icons.Outlined.Share,
onClick = onShareClick, onClick = onShareClick,
), ),
AppBar.Action( AppBar.Action(
title = localize(MR.strings.action_save), title = stringResource(MR.strings.action_save),
icon = Icons.Outlined.Save, icon = Icons.Outlined.Save,
onClick = onSaveClick, onClick = onSaveClick,
), ),
@ -119,7 +119,7 @@ fun MangaCoverDialog(
) { ) {
Icon( Icon(
imageVector = Icons.Outlined.Edit, imageVector = Icons.Outlined.Edit,
contentDescription = localize(MR.strings.action_edit_cover), contentDescription = stringResource(MR.strings.action_edit_cover),
) )
} }
DropdownMenu( DropdownMenu(
@ -128,14 +128,14 @@ fun MangaCoverDialog(
offset = DpOffset(8.dp, 0.dp), offset = DpOffset(8.dp, 0.dp),
) { ) {
DropdownMenuItem( DropdownMenuItem(
text = { Text(text = localize(MR.strings.action_edit)) }, text = { Text(text = stringResource(MR.strings.action_edit)) },
onClick = { onClick = {
onEditClick(EditCoverAction.EDIT) onEditClick(EditCoverAction.EDIT)
expanded = false expanded = false
}, },
) )
DropdownMenuItem( DropdownMenuItem(
text = { Text(text = localize(MR.strings.action_delete)) }, text = { Text(text = stringResource(MR.strings.action_delete)) },
onClick = { onClick = {
onEditClick(EditCoverAction.DELETE) onEditClick(EditCoverAction.DELETE)
expanded = false expanded = false

View File

@ -80,8 +80,8 @@ import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.TextButton import tachiyomi.presentation.core.components.material.TextButton
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.pluralStringResource
import tachiyomi.presentation.core.i18n.localizePlural import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.clickableNoIndication import tachiyomi.presentation.core.util.clickableNoIndication
import tachiyomi.presentation.core.util.secondaryItemAlpha import tachiyomi.presentation.core.util.secondaryItemAlpha
import kotlin.math.absoluteValue import kotlin.math.absoluteValue
@ -181,9 +181,9 @@ fun MangaActionRow(
Row(modifier = modifier.padding(start = 16.dp, top = 8.dp, end = 16.dp)) { Row(modifier = modifier.padding(start = 16.dp, top = 8.dp, end = 16.dp)) {
MangaActionButton( MangaActionButton(
title = if (favorite) { title = if (favorite) {
localize(MR.strings.in_library) stringResource(MR.strings.in_library)
} else { } else {
localize(MR.strings.add_to_library) stringResource(MR.strings.add_to_library)
}, },
icon = if (favorite) Icons.Filled.Favorite else Icons.Outlined.FavoriteBorder, icon = if (favorite) Icons.Filled.Favorite else Icons.Outlined.FavoriteBorder,
color = if (favorite) MaterialTheme.colorScheme.primary else defaultActionButtonColor, color = if (favorite) MaterialTheme.colorScheme.primary else defaultActionButtonColor,
@ -192,7 +192,7 @@ fun MangaActionRow(
) )
if (onEditIntervalClicked != null && fetchInterval != null) { if (onEditIntervalClicked != null && fetchInterval != null) {
MangaActionButton( MangaActionButton(
title = localizePlural( title = pluralStringResource(
MR.plurals.day, MR.plurals.day,
count = fetchInterval.absoluteValue, count = fetchInterval.absoluteValue,
fetchInterval.absoluteValue, fetchInterval.absoluteValue,
@ -205,9 +205,9 @@ fun MangaActionRow(
if (onTrackingClicked != null) { if (onTrackingClicked != null) {
MangaActionButton( MangaActionButton(
title = if (trackingCount == 0) { title = if (trackingCount == 0) {
localize(MR.strings.manga_tracking_tab) stringResource(MR.strings.manga_tracking_tab)
} else { } else {
localizePlural(MR.plurals.num_trackers, count = trackingCount, trackingCount) pluralStringResource(MR.plurals.num_trackers, count = trackingCount, trackingCount)
}, },
icon = if (trackingCount == 0) Icons.Outlined.Sync else Icons.Outlined.Done, icon = if (trackingCount == 0) Icons.Outlined.Sync else Icons.Outlined.Done,
color = if (trackingCount == 0) defaultActionButtonColor else MaterialTheme.colorScheme.primary, color = if (trackingCount == 0) defaultActionButtonColor else MaterialTheme.colorScheme.primary,
@ -216,7 +216,7 @@ fun MangaActionRow(
} }
if (onWebViewClicked != null) { if (onWebViewClicked != null) {
MangaActionButton( MangaActionButton(
title = localize(MR.strings.action_web_view), title = stringResource(MR.strings.action_web_view),
icon = Icons.Outlined.Public, icon = Icons.Outlined.Public,
color = defaultActionButtonColor, color = defaultActionButtonColor,
onClick = onWebViewClicked, onClick = onWebViewClicked,
@ -254,7 +254,7 @@ fun ExpandableMangaDescription(
mutableStateOf(defaultExpandState) mutableStateOf(defaultExpandState)
} }
val desc = val desc =
description.takeIf { !it.isNullOrBlank() } ?: localize(MR.strings.description_placeholder) description.takeIf { !it.isNullOrBlank() } ?: stringResource(MR.strings.description_placeholder)
val trimmedDescription = remember(desc) { val trimmedDescription = remember(desc) {
desc desc
.replace(whitespaceLineRegex, "\n") .replace(whitespaceLineRegex, "\n")
@ -284,7 +284,7 @@ fun ExpandableMangaDescription(
onDismissRequest = { showMenu = false }, onDismissRequest = { showMenu = false },
) { ) {
DropdownMenuItem( DropdownMenuItem(
text = { Text(text = localize(MR.strings.action_search)) }, text = { Text(text = stringResource(MR.strings.action_search)) },
onClick = { onClick = {
onTagSearch(tagSelected) onTagSearch(tagSelected)
showMenu = false showMenu = false
@ -300,7 +300,7 @@ fun ExpandableMangaDescription(
) )
// SY <-- // SY <--
DropdownMenuItem( DropdownMenuItem(
text = { Text(text = localize(MR.strings.action_copy_to_clipboard)) }, text = { Text(text = stringResource(MR.strings.action_copy_to_clipboard)) },
onClick = { onClick = {
onCopyTagToClipboard(tagSelected) onCopyTagToClipboard(tagSelected)
showMenu = false showMenu = false
@ -379,7 +379,7 @@ private fun MangaAndSourceTitlesLarge(
MangaCover.Book( MangaCover.Book(
modifier = Modifier.fillMaxWidth(0.65f), modifier = Modifier.fillMaxWidth(0.65f),
data = coverDataProvider(), data = coverDataProvider(),
contentDescription = localize(MR.strings.manga_cover), contentDescription = stringResource(MR.strings.manga_cover),
onClick = onCoverClick, onClick = onCoverClick,
) )
Spacer(modifier = Modifier.height(16.dp)) Spacer(modifier = Modifier.height(16.dp))
@ -421,7 +421,7 @@ private fun MangaAndSourceTitlesSmall(
.sizeIn(maxWidth = 100.dp) .sizeIn(maxWidth = 100.dp)
.align(Alignment.Top), .align(Alignment.Top),
data = coverDataProvider(), data = coverDataProvider(),
contentDescription = localize(MR.strings.manga_cover), contentDescription = stringResource(MR.strings.manga_cover),
onClick = onCoverClick, onClick = onCoverClick,
) )
Column( Column(
@ -453,7 +453,7 @@ private fun MangaContentInfo(
) { ) {
val context = LocalContext.current val context = LocalContext.current
Text( Text(
text = title.ifBlank { localize(MR.strings.unknown_title) }, text = title.ifBlank { stringResource(MR.strings.unknown_title) },
style = MaterialTheme.typography.titleLarge, style = MaterialTheme.typography.titleLarge,
modifier = Modifier.clickableNoIndication( modifier = Modifier.clickableNoIndication(
onLongClick = { onLongClick = {
@ -483,7 +483,7 @@ private fun MangaContentInfo(
) )
Text( Text(
text = author?.takeIf { it.isNotBlank() } text = author?.takeIf { it.isNotBlank() }
?: localize(MR.strings.unknown_author), ?: stringResource(MR.strings.unknown_author),
style = MaterialTheme.typography.titleSmall, style = MaterialTheme.typography.titleSmall,
modifier = Modifier modifier = Modifier
.clickableNoIndication( .clickableNoIndication(
@ -549,13 +549,13 @@ private fun MangaContentInfo(
ProvideTextStyle(MaterialTheme.typography.bodyMedium) { ProvideTextStyle(MaterialTheme.typography.bodyMedium) {
Text( Text(
text = when (status) { text = when (status) {
SManga.ONGOING.toLong() -> localize(MR.strings.ongoing) SManga.ONGOING.toLong() -> stringResource(MR.strings.ongoing)
SManga.COMPLETED.toLong() -> localize(MR.strings.completed) SManga.COMPLETED.toLong() -> stringResource(MR.strings.completed)
SManga.LICENSED.toLong() -> localize(MR.strings.licensed) SManga.LICENSED.toLong() -> stringResource(MR.strings.licensed)
SManga.PUBLISHING_FINISHED.toLong() -> localize(MR.strings.publishing_finished) SManga.PUBLISHING_FINISHED.toLong() -> stringResource(MR.strings.publishing_finished)
SManga.CANCELLED.toLong() -> localize(MR.strings.cancelled) SManga.CANCELLED.toLong() -> stringResource(MR.strings.cancelled)
SManga.ON_HIATUS.toLong() -> localize(MR.strings.on_hiatus) SManga.ON_HIATUS.toLong() -> stringResource(MR.strings.on_hiatus)
else -> localize(MR.strings.unknown) else -> stringResource(MR.strings.unknown)
}, },
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
maxLines = 1, maxLines = 1,
@ -629,7 +629,7 @@ private fun MangaSummary(
val image = AnimatedImageVector.animatedVectorResource(R.drawable.anim_caret_down) val image = AnimatedImageVector.animatedVectorResource(R.drawable.anim_caret_down)
Icon( Icon(
painter = rememberAnimatedVectorPainter(image, !expanded), painter = rememberAnimatedVectorPainter(image, !expanded),
contentDescription = localize( contentDescription = stringResource(
if (expanded) MR.strings.manga_info_collapse else MR.strings.manga_info_expand, if (expanded) MR.strings.manga_info_collapse else MR.strings.manga_info_expand,
), ),
tint = MaterialTheme.colorScheme.onBackground, tint = MaterialTheme.colorScheme.onBackground,

View File

@ -30,7 +30,7 @@ import eu.kanade.presentation.components.UpIcon
import eu.kanade.presentation.manga.DownloadAction import eu.kanade.presentation.manga.DownloadAction
import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.theme.active import tachiyomi.presentation.core.theme.active
@Composable @Composable
@ -81,12 +81,12 @@ fun MangaToolbar(
AppBarActions( AppBarActions(
persistentListOf( persistentListOf(
AppBar.Action( AppBar.Action(
title = localize(MR.strings.action_select_all), title = stringResource(MR.strings.action_select_all),
icon = Icons.Outlined.SelectAll, icon = Icons.Outlined.SelectAll,
onClick = onSelectAll, onClick = onSelectAll,
), ),
AppBar.Action( AppBar.Action(
title = localize(MR.strings.action_select_inverse), title = stringResource(MR.strings.action_select_inverse),
icon = Icons.Outlined.FlipToBack, icon = Icons.Outlined.FlipToBack,
onClick = onInvertSelection, onClick = onInvertSelection,
), ),
@ -110,7 +110,7 @@ fun MangaToolbar(
if (onClickDownload != null) { if (onClickDownload != null) {
add( add(
AppBar.Action( AppBar.Action(
title = localize(MR.strings.manga_download), title = stringResource(MR.strings.manga_download),
icon = Icons.Outlined.Download, icon = Icons.Outlined.Download,
onClick = { downloadExpanded = !downloadExpanded }, onClick = { downloadExpanded = !downloadExpanded },
), ),
@ -118,7 +118,7 @@ fun MangaToolbar(
} }
add( add(
AppBar.Action( AppBar.Action(
title = localize(MR.strings.action_filter), title = stringResource(MR.strings.action_filter),
icon = Icons.Outlined.FilterList, icon = Icons.Outlined.FilterList,
iconTint = filterTint, iconTint = filterTint,
onClick = onClickFilter, onClick = onClickFilter,
@ -126,14 +126,14 @@ fun MangaToolbar(
) )
add( add(
AppBar.OverflowAction( AppBar.OverflowAction(
title = localize(MR.strings.action_webview_refresh), title = stringResource(MR.strings.action_webview_refresh),
onClick = onClickRefresh, onClick = onClickRefresh,
), ),
) )
if (onClickEditCategory != null) { if (onClickEditCategory != null) {
add( add(
AppBar.OverflowAction( AppBar.OverflowAction(
title = localize(MR.strings.action_edit_categories), title = stringResource(MR.strings.action_edit_categories),
onClick = onClickEditCategory, onClick = onClickEditCategory,
), ),
) )
@ -141,7 +141,7 @@ fun MangaToolbar(
if (onClickMigrate != null) { if (onClickMigrate != null) {
add( add(
AppBar.OverflowAction( AppBar.OverflowAction(
title = localize(MR.strings.action_migrate), title = stringResource(MR.strings.action_migrate),
onClick = onClickMigrate, onClick = onClickMigrate,
), ),
) )
@ -149,7 +149,7 @@ fun MangaToolbar(
if (onClickShare != null) { if (onClickShare != null) {
add( add(
AppBar.OverflowAction( AppBar.OverflowAction(
title = localize(MR.strings.action_share), title = stringResource(MR.strings.action_share),
onClick = onClickShare, onClick = onClickShare,
), ),
) )

View File

@ -14,7 +14,7 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark
import eu.kanade.presentation.theme.TachiyomiTheme import eu.kanade.presentation.theme.TachiyomiTheme
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localizePlural import tachiyomi.presentation.core.i18n.pluralStringResource
import tachiyomi.presentation.core.util.secondaryItemAlpha import tachiyomi.presentation.core.util.secondaryItemAlpha
@Composable @Composable
@ -34,7 +34,7 @@ fun MissingChapterCountListItem(
) { ) {
HorizontalDivider(modifier = Modifier.weight(1f)) HorizontalDivider(modifier = Modifier.weight(1f))
Text( Text(
text = localizePlural(MR.plurals.missing_chapters, count = count, count), text = pluralStringResource(MR.plurals.missing_chapters, count = count, count),
style = MaterialTheme.typography.labelMedium, style = MaterialTheme.typography.labelMedium,
) )
HorizontalDivider(modifier = Modifier.weight(1f)) HorizontalDivider(modifier = Modifier.weight(1f))

View File

@ -20,9 +20,7 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.minimumInteractiveComponentSize import androidx.compose.material3.minimumInteractiveComponentSize
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.runtime.toMutableStateList import androidx.compose.runtime.toMutableStateList
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
@ -32,7 +30,7 @@ import androidx.compose.ui.window.DialogProperties
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.TextButton import tachiyomi.presentation.core.components.material.TextButton
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.isScrolledToEnd import tachiyomi.presentation.core.util.isScrolledToEnd
import tachiyomi.presentation.core.util.isScrolledToStart import tachiyomi.presentation.core.util.isScrolledToStart
@ -49,10 +47,10 @@ fun ScanlatorFilterDialog(
val mutableExcludedScanlators = remember(excludedScanlators) { excludedScanlators.toMutableStateList() } val mutableExcludedScanlators = remember(excludedScanlators) { excludedScanlators.toMutableStateList() }
AlertDialog( AlertDialog(
onDismissRequest = onDismissRequest, onDismissRequest = onDismissRequest,
title = { Text(text = localize(MR.strings.exclude_scanlators)) }, title = { Text(text = stringResource(MR.strings.exclude_scanlators)) },
text = textFunc@{ text = textFunc@{
if (sortedAvailableScanlators.isEmpty()) { if (sortedAvailableScanlators.isEmpty()) {
Text(text = localize(MR.strings.no_scanlators_found)) Text(text = stringResource(MR.strings.no_scanlators_found))
return@textFunc return@textFunc
} }
Box { Box {
@ -108,16 +106,16 @@ fun ScanlatorFilterDialog(
confirmButton = { confirmButton = {
if (sortedAvailableScanlators.isEmpty()) { if (sortedAvailableScanlators.isEmpty()) {
TextButton(onClick = onDismissRequest) { TextButton(onClick = onDismissRequest) {
Text(text = localize(MR.strings.action_cancel)) Text(text = stringResource(MR.strings.action_cancel))
} }
} else { } else {
FlowRow { FlowRow {
TextButton(onClick = mutableExcludedScanlators::clear) { TextButton(onClick = mutableExcludedScanlators::clear) {
Text(text = localize(MR.strings.action_reset)) Text(text = stringResource(MR.strings.action_reset))
} }
Spacer(modifier = Modifier.weight(1f)) Spacer(modifier = Modifier.weight(1f))
TextButton(onClick = onDismissRequest) { TextButton(onClick = onDismissRequest) {
Text(text = localize(MR.strings.action_cancel)) Text(text = stringResource(MR.strings.action_cancel))
} }
TextButton( TextButton(
onClick = { onClick = {
@ -125,7 +123,7 @@ fun ScanlatorFilterDialog(
onDismissRequest() onDismissRequest()
}, },
) { ) {
Text(text = localize(MR.strings.action_ok)) Text(text = stringResource(MR.strings.action_ok))
} }
} }
} }

View File

@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.width
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.OpenInNew import androidx.compose.material.icons.automirrored.outlined.OpenInNew
import androidx.compose.material.icons.filled.OpenInNew
import androidx.compose.material.icons.outlined.NewReleases import androidx.compose.material.icons.outlined.NewReleases
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
@ -23,7 +22,7 @@ import com.halilibo.richtext.ui.string.RichTextStringStyle
import eu.kanade.presentation.theme.TachiyomiTheme import eu.kanade.presentation.theme.TachiyomiTheme
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.InfoScreen import tachiyomi.presentation.core.screens.InfoScreen
@Composable @Composable
@ -36,11 +35,11 @@ fun NewUpdateScreen(
) { ) {
InfoScreen( InfoScreen(
icon = Icons.Outlined.NewReleases, icon = Icons.Outlined.NewReleases,
headingText = localize(MR.strings.update_check_notification_update_available), headingText = stringResource(MR.strings.update_check_notification_update_available),
subtitleText = versionName, subtitleText = versionName,
acceptText = localize(MR.strings.update_check_confirm), acceptText = stringResource(MR.strings.update_check_confirm),
onAcceptClick = onAcceptUpdate, onAcceptClick = onAcceptUpdate,
rejectText = localize(MR.strings.action_not_now), rejectText = stringResource(MR.strings.action_not_now),
onRejectClick = onRejectUpdate, onRejectClick = onRejectUpdate,
) { ) {
Material3RichText( Material3RichText(
@ -59,7 +58,7 @@ fun NewUpdateScreen(
onClick = onOpenInBrowser, onClick = onOpenInBrowser,
modifier = Modifier.padding(top = MaterialTheme.padding.small), modifier = Modifier.padding(top = MaterialTheme.padding.small),
) { ) {
Text(text = localize(MR.strings.update_check_open)) Text(text = stringResource(MR.strings.update_check_open))
Spacer(modifier = Modifier.width(MaterialTheme.padding.tiny)) Spacer(modifier = Modifier.width(MaterialTheme.padding.tiny))
Icon(imageVector = Icons.AutoMirrored.Outlined.OpenInNew, contentDescription = null) Icon(imageVector = Icons.AutoMirrored.Outlined.OpenInNew, contentDescription = null)
} }

View File

@ -5,7 +5,7 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector
import eu.kanade.tachiyomi.data.track.Tracker import eu.kanade.tachiyomi.data.track.Tracker
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.core.preference.Preference as PreferenceData import tachiyomi.core.preference.Preference as PreferenceData
sealed class Preference { sealed class Preference {
@ -112,7 +112,7 @@ sealed class Preference {
v.map { e[it] } v.map { e[it] }
.takeIf { it.isNotEmpty() } .takeIf { it.isNotEmpty() }
?.joinToString() ?.joinToString()
} ?: localize(MR.strings.none) } ?: stringResource(MR.strings.none)
subtitle?.format(combined) subtitle?.format(combined)
}, },
override val icon: ImageVector? = null, override val icon: ImageVector? = null,

View File

@ -5,7 +5,7 @@ import androidx.compose.runtime.Composable
import dev.icerock.moko.resources.StringResource import dev.icerock.moko.resources.StringResource
import eu.kanade.presentation.components.AppBar import eu.kanade.presentation.components.AppBar
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun PreferenceScaffold( fun PreferenceScaffold(
@ -17,7 +17,7 @@ fun PreferenceScaffold(
Scaffold( Scaffold(
topBar = { topBar = {
AppBar( AppBar(
title = localize(titleRes), title = stringResource(titleRes),
navigateUp = onBackPressed, navigateUp = onBackPressed,
actions = actions, actions = actions,
scrollBehavior = it, scrollBehavior = it,

View File

@ -6,7 +6,7 @@ import androidx.compose.ui.platform.LocalContext
import eu.kanade.presentation.category.visualName import eu.kanade.presentation.category.visualName
import tachiyomi.domain.category.model.Category import tachiyomi.domain.category.model.Category
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
/** /**
* Returns a string of categories name for settings subtitle * Returns a string of categories name for settings subtitle
@ -34,15 +34,15 @@ fun getCategoriesLabel(
includedCategories.isNotEmpty() && includedCategories.size != allCategories.size -> includedCategories.isNotEmpty() && includedCategories.size != allCategories.size ->
includedCategories.joinToString { it.visualName(context) } includedCategories.joinToString { it.visualName(context) }
// All explicitly selected // All explicitly selected
includedCategories.size == allCategories.size -> localize(MR.strings.all) includedCategories.size == allCategories.size -> stringResource(MR.strings.all)
allExcluded -> localize(MR.strings.none) allExcluded -> stringResource(MR.strings.none)
else -> localize(MR.strings.all) else -> stringResource(MR.strings.all)
} }
val excludedItemsText = when { val excludedItemsText = when {
excludedCategories.isEmpty() -> localize(MR.strings.none) excludedCategories.isEmpty() -> stringResource(MR.strings.none)
allExcluded -> localize(MR.strings.all) allExcluded -> stringResource(MR.strings.all)
else -> excludedCategories.joinToString { it.visualName(context) } else -> excludedCategories.joinToString { it.visualName(context) }
} }
return localize(MR.strings.include, includedItemsText) + "\n" + return stringResource(MR.strings.include, includedItemsText) + "\n" +
localize(MR.strings.exclude, excludedItemsText) stringResource(MR.strings.exclude, excludedItemsText)
} }

View File

@ -27,9 +27,9 @@ import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.drop import kotlinx.coroutines.flow.drop
import kotlinx.coroutines.flow.merge import kotlinx.coroutines.flow.merge
import org.xmlpull.v1.XmlPullParser import org.xmlpull.v1.XmlPullParser
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
@ -80,26 +80,26 @@ object SettingsAppearanceScreen : SearchableSettings {
} }
return Preference.PreferenceGroup( return Preference.PreferenceGroup(
title = localize(MR.strings.pref_category_theme), title = stringResource(MR.strings.pref_category_theme),
preferenceItems = listOf( preferenceItems = listOf(
Preference.PreferenceItem.ListPreference( Preference.PreferenceItem.ListPreference(
pref = themeModePref, pref = themeModePref,
title = localize(MR.strings.pref_theme_mode), title = stringResource(MR.strings.pref_theme_mode),
entries = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { entries = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mapOf( mapOf(
ThemeMode.SYSTEM to localize(MR.strings.theme_system), ThemeMode.SYSTEM to stringResource(MR.strings.theme_system),
ThemeMode.LIGHT to localize(MR.strings.theme_light), ThemeMode.LIGHT to stringResource(MR.strings.theme_light),
ThemeMode.DARK to localize(MR.strings.theme_dark), ThemeMode.DARK to stringResource(MR.strings.theme_dark),
) )
} else { } else {
mapOf( mapOf(
ThemeMode.LIGHT to localize(MR.strings.theme_light), ThemeMode.LIGHT to stringResource(MR.strings.theme_light),
ThemeMode.DARK to localize(MR.strings.theme_dark), ThemeMode.DARK to stringResource(MR.strings.theme_dark),
) )
}, },
), ),
Preference.PreferenceItem.CustomPreference( Preference.PreferenceItem.CustomPreference(
title = localize(MR.strings.pref_app_theme), title = stringResource(MR.strings.pref_app_theme),
) { item -> ) { item ->
val value by appThemePref.collectAsState() val value by appThemePref.collectAsState()
AppThemePreferenceWidget( AppThemePreferenceWidget(
@ -111,7 +111,7 @@ object SettingsAppearanceScreen : SearchableSettings {
}, },
Preference.PreferenceItem.SwitchPreference( Preference.PreferenceItem.SwitchPreference(
pref = amoledPref, pref = amoledPref,
title = localize(MR.strings.pref_dark_theme_pure_black), title = stringResource(MR.strings.pref_dark_theme_pure_black),
enabled = themeMode != ThemeMode.LIGHT, enabled = themeMode != ThemeMode.LIGHT,
), ),
), ),
@ -144,11 +144,11 @@ object SettingsAppearanceScreen : SearchableSettings {
} }
return Preference.PreferenceGroup( return Preference.PreferenceGroup(
title = localize(MR.strings.pref_category_display), title = stringResource(MR.strings.pref_category_display),
preferenceItems = listOf( preferenceItems = listOf(
Preference.PreferenceItem.BasicListPreference( Preference.PreferenceItem.BasicListPreference(
value = currentLanguage, value = currentLanguage,
title = localize(MR.strings.pref_app_language), title = stringResource(MR.strings.pref_app_language),
entries = langs, entries = langs,
onValueChanged = { newValue -> onValueChanged = { newValue ->
currentLanguage = newValue currentLanguage = newValue
@ -157,8 +157,8 @@ object SettingsAppearanceScreen : SearchableSettings {
), ),
Preference.PreferenceItem.ListPreference( Preference.PreferenceItem.ListPreference(
pref = uiPreferences.tabletUiMode(), pref = uiPreferences.tabletUiMode(),
title = localize(MR.strings.pref_tablet_ui_mode), title = stringResource(MR.strings.pref_tablet_ui_mode),
entries = TabletUiMode.entries.associateWith { localize(it.titleRes) }, entries = TabletUiMode.entries.associateWith { stringResource(it.titleRes) },
onValueChanged = { onValueChanged = {
context.toast(MR.strings.requires_app_restart) context.toast(MR.strings.requires_app_restart)
true true
@ -166,19 +166,19 @@ object SettingsAppearanceScreen : SearchableSettings {
), ),
Preference.PreferenceItem.ListPreference( Preference.PreferenceItem.ListPreference(
pref = uiPreferences.dateFormat(), pref = uiPreferences.dateFormat(),
title = localize(MR.strings.pref_date_format), title = stringResource(MR.strings.pref_date_format),
entries = DateFormats entries = DateFormats
.associateWith { .associateWith {
val formattedDate = UiPreferences.dateFormat(it).format(now) val formattedDate = UiPreferences.dateFormat(it).format(now)
"${it.ifEmpty { localize(MR.strings.label_default) }} ($formattedDate)" "${it.ifEmpty { stringResource(MR.strings.label_default) }} ($formattedDate)"
}, },
), ),
Preference.PreferenceItem.SwitchPreference( Preference.PreferenceItem.SwitchPreference(
pref = uiPreferences.relativeTime(), pref = uiPreferences.relativeTime(),
title = localize(MR.strings.pref_relative_format), title = stringResource(MR.strings.pref_relative_format),
subtitle = localize( subtitle = stringResource(
MR.strings.pref_relative_format_summary, MR.strings.pref_relative_format_summary,
localize(MR.strings.relative_time_today), stringResource(MR.strings.relative_time_today),
formattedNow, formattedNow,
), ),
), ),
@ -205,7 +205,7 @@ object SettingsAppearanceScreen : SearchableSettings {
} }
langs.sortBy { it.second } langs.sortBy { it.second }
langs.add(0, Pair("", context.localize(MR.strings.label_default))) langs.add(0, Pair("", context.stringResource(MR.strings.label_default)))
return langs.toMap() return langs.toMap()
} }

View File

@ -44,14 +44,14 @@ import eu.kanade.tachiyomi.util.system.DeviceUtil
import eu.kanade.tachiyomi.util.system.copyToClipboard import eu.kanade.tachiyomi.util.system.copyToClipboard
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
import logcat.LogPriority import logcat.LogPriority
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.lang.launchNonCancellable import tachiyomi.core.util.lang.launchNonCancellable
import tachiyomi.core.util.lang.withUIContext import tachiyomi.core.util.lang.withUIContext
import tachiyomi.core.util.system.logcat import tachiyomi.core.util.system.logcat
import tachiyomi.domain.backup.service.BackupPreferences import tachiyomi.domain.backup.service.BackupPreferences
import tachiyomi.domain.library.service.LibraryPreferences import tachiyomi.domain.library.service.LibraryPreferences
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
@ -82,7 +82,7 @@ object SettingsDataScreen : SearchableSettings {
val lastAutoBackup by backupPreferences.lastAutoBackupTimestamp().collectAsState() val lastAutoBackup by backupPreferences.lastAutoBackupTimestamp().collectAsState()
return Preference.PreferenceGroup( return Preference.PreferenceGroup(
title = localize(MR.strings.label_backup), title = stringResource(MR.strings.label_backup),
preferenceItems = listOf( preferenceItems = listOf(
// Manual actions // Manual actions
getCreateBackupPref(), getCreateBackupPref(),
@ -91,14 +91,14 @@ object SettingsDataScreen : SearchableSettings {
// Automatic backups // Automatic backups
Preference.PreferenceItem.ListPreference( Preference.PreferenceItem.ListPreference(
pref = backupIntervalPref, pref = backupIntervalPref,
title = localize(MR.strings.pref_backup_interval), title = stringResource(MR.strings.pref_backup_interval),
entries = mapOf( entries = mapOf(
0 to localize(MR.strings.off), 0 to stringResource(MR.strings.off),
6 to localize(MR.strings.update_6hour), 6 to stringResource(MR.strings.update_6hour),
12 to localize(MR.strings.update_12hour), 12 to stringResource(MR.strings.update_12hour),
24 to localize(MR.strings.update_24hour), 24 to stringResource(MR.strings.update_24hour),
48 to localize(MR.strings.update_48hour), 48 to stringResource(MR.strings.update_48hour),
168 to localize(MR.strings.update_weekly), 168 to stringResource(MR.strings.update_weekly),
), ),
onValueChanged = { onValueChanged = {
BackupCreateJob.setupTask(context, it) BackupCreateJob.setupTask(context, it)
@ -108,12 +108,12 @@ object SettingsDataScreen : SearchableSettings {
Preference.PreferenceItem.ListPreference( Preference.PreferenceItem.ListPreference(
pref = backupPreferences.numberOfBackups(), pref = backupPreferences.numberOfBackups(),
enabled = backupInterval != 0, enabled = backupInterval != 0,
title = localize(MR.strings.pref_backup_slots), title = stringResource(MR.strings.pref_backup_slots),
entries = listOf(2, 3, 4, 5).associateWith { it.toString() }, entries = listOf(2, 3, 4, 5).associateWith { it.toString() },
), ),
Preference.PreferenceItem.InfoPreference( Preference.PreferenceItem.InfoPreference(
localize(MR.strings.backup_info) + "\n\n" + stringResource(MR.strings.backup_info) + "\n\n" +
localize(MR.strings.last_auto_backup_info, relativeTimeSpanString(lastAutoBackup)), stringResource(MR.strings.last_auto_backup_info, relativeTimeSpanString(lastAutoBackup)),
), ),
), ),
) )
@ -123,8 +123,8 @@ object SettingsDataScreen : SearchableSettings {
private fun getCreateBackupPref(): Preference.PreferenceItem.TextPreference { private fun getCreateBackupPref(): Preference.PreferenceItem.TextPreference {
val navigator = LocalNavigator.currentOrThrow val navigator = LocalNavigator.currentOrThrow
return Preference.PreferenceItem.TextPreference( return Preference.PreferenceItem.TextPreference(
title = localize(MR.strings.pref_create_backup), title = stringResource(MR.strings.pref_create_backup),
subtitle = localize(MR.strings.pref_create_backup_summ), subtitle = stringResource(MR.strings.pref_create_backup_summ),
onClick = { navigator.push(CreateBackupScreen()) }, onClick = { navigator.push(CreateBackupScreen()) },
) )
} }
@ -139,7 +139,7 @@ object SettingsDataScreen : SearchableSettings {
is InvalidRestore -> { is InvalidRestore -> {
AlertDialog( AlertDialog(
onDismissRequest = onDismissRequest, onDismissRequest = onDismissRequest,
title = { Text(text = localize(MR.strings.invalid_backup_file)) }, title = { Text(text = stringResource(MR.strings.invalid_backup_file)) },
text = { Text(text = listOfNotNull(err.uri, err.message).joinToString("\n\n")) }, text = { Text(text = listOfNotNull(err.uri, err.message).joinToString("\n\n")) },
dismissButton = { dismissButton = {
TextButton( TextButton(
@ -148,12 +148,12 @@ object SettingsDataScreen : SearchableSettings {
onDismissRequest() onDismissRequest()
}, },
) { ) {
Text(text = localize(MR.strings.action_copy_to_clipboard)) Text(text = stringResource(MR.strings.action_copy_to_clipboard))
} }
}, },
confirmButton = { confirmButton = {
TextButton(onClick = onDismissRequest) { TextButton(onClick = onDismissRequest) {
Text(text = localize(MR.strings.action_ok)) Text(text = stringResource(MR.strings.action_ok))
} }
}, },
) )
@ -161,15 +161,15 @@ object SettingsDataScreen : SearchableSettings {
is MissingRestoreComponents -> { is MissingRestoreComponents -> {
AlertDialog( AlertDialog(
onDismissRequest = onDismissRequest, onDismissRequest = onDismissRequest,
title = { Text(text = localize(MR.strings.pref_restore_backup)) }, title = { Text(text = stringResource(MR.strings.pref_restore_backup)) },
text = { text = {
Column( Column(
modifier = Modifier.verticalScroll(rememberScrollState()), modifier = Modifier.verticalScroll(rememberScrollState()),
) { ) {
val msg = buildString { val msg = buildString {
append(localize(MR.strings.backup_restore_content_full)) append(stringResource(MR.strings.backup_restore_content_full))
if (err.sources.isNotEmpty()) { if (err.sources.isNotEmpty()) {
append("\n\n").append(localize(MR.strings.backup_restore_missing_sources)) append("\n\n").append(stringResource(MR.strings.backup_restore_missing_sources))
err.sources.joinTo( err.sources.joinTo(
this, this,
separator = "\n- ", separator = "\n- ",
@ -177,7 +177,9 @@ object SettingsDataScreen : SearchableSettings {
) )
} }
if (err.trackers.isNotEmpty()) { if (err.trackers.isNotEmpty()) {
append("\n\n").append(localize(MR.strings.backup_restore_missing_trackers)) append(
"\n\n",
).append(stringResource(MR.strings.backup_restore_missing_trackers))
err.trackers.joinTo( err.trackers.joinTo(
this, this,
separator = "\n- ", separator = "\n- ",
@ -195,7 +197,7 @@ object SettingsDataScreen : SearchableSettings {
onDismissRequest() onDismissRequest()
}, },
) { ) {
Text(text = localize(MR.strings.action_restore)) Text(text = stringResource(MR.strings.action_restore))
} }
}, },
) )
@ -208,7 +210,7 @@ object SettingsDataScreen : SearchableSettings {
object : ActivityResultContracts.GetContent() { object : ActivityResultContracts.GetContent() {
override fun createIntent(context: Context, input: String): Intent { override fun createIntent(context: Context, input: String): Intent {
val intent = super.createIntent(context, input) val intent = super.createIntent(context, input)
return Intent.createChooser(intent, context.localize(MR.strings.file_select_backup)) return Intent.createChooser(intent, context.stringResource(MR.strings.file_select_backup))
} }
}, },
) { ) {
@ -233,8 +235,8 @@ object SettingsDataScreen : SearchableSettings {
} }
return Preference.PreferenceItem.TextPreference( return Preference.PreferenceItem.TextPreference(
title = localize(MR.strings.pref_restore_backup), title = stringResource(MR.strings.pref_restore_backup),
subtitle = localize(MR.strings.pref_restore_backup_summ), subtitle = stringResource(MR.strings.pref_restore_backup_summ),
onClick = { onClick = {
if (!BackupRestoreJob.isRunning(context)) { if (!BackupRestoreJob.isRunning(context)) {
if (DeviceUtil.isMiui && DeviceUtil.isMiuiOptimizationDisabled()) { if (DeviceUtil.isMiui && DeviceUtil.isMiuiOptimizationDisabled()) {
@ -266,19 +268,19 @@ object SettingsDataScreen : SearchableSettings {
// SY <-- // SY <--
return Preference.PreferenceGroup( return Preference.PreferenceGroup(
title = localize(MR.strings.label_data), title = stringResource(MR.strings.label_data),
preferenceItems = listOf( preferenceItems = listOf(
getStorageInfoPref(cacheReadableSize), getStorageInfoPref(cacheReadableSize),
Preference.PreferenceItem.TextPreference( Preference.PreferenceItem.TextPreference(
title = localize(MR.strings.pref_clear_chapter_cache), title = stringResource(MR.strings.pref_clear_chapter_cache),
subtitle = localize(MR.strings.used_cache, cacheReadableSize), subtitle = stringResource(MR.strings.used_cache, cacheReadableSize),
onClick = { onClick = {
scope.launchNonCancellable { scope.launchNonCancellable {
try { try {
val deletedFiles = chapterCache.clear() val deletedFiles = chapterCache.clear()
withUIContext { withUIContext {
context.toast(context.localize(MR.strings.cache_deleted, deletedFiles)) context.toast(context.stringResource(MR.strings.cache_deleted, deletedFiles))
cacheReadableSizeSema++ cacheReadableSizeSema++
} }
} catch (e: Throwable) { } catch (e: Throwable) {
@ -310,7 +312,7 @@ object SettingsDataScreen : SearchableSettings {
// SY <-- // SY <--
Preference.PreferenceItem.SwitchPreference( Preference.PreferenceItem.SwitchPreference(
pref = libraryPreferences.autoClearChapterCache(), pref = libraryPreferences.autoClearChapterCache(),
title = localize(MR.strings.pref_auto_clear_chapter_cache), title = stringResource(MR.strings.pref_auto_clear_chapter_cache),
), ),
), ),
) )
@ -329,10 +331,10 @@ object SettingsDataScreen : SearchableSettings {
} }
return Preference.PreferenceItem.CustomPreference( return Preference.PreferenceItem.CustomPreference(
title = localize(MR.strings.pref_storage_usage), title = stringResource(MR.strings.pref_storage_usage),
) { ) {
BasePreferenceWidget( BasePreferenceWidget(
title = localize(MR.strings.pref_storage_usage), title = stringResource(MR.strings.pref_storage_usage),
subcomponent = { subcomponent = {
// TODO: downloads, SD cards, bar representation?, i18n // TODO: downloads, SD cards, bar representation?, i18n
Box(modifier = Modifier.padding(horizontal = PrefsHorizontalPadding)) { Box(modifier = Modifier.padding(horizontal = PrefsHorizontalPadding)) {

View File

@ -24,8 +24,8 @@ import tachiyomi.domain.category.interactor.GetCategories
import tachiyomi.domain.category.model.Category import tachiyomi.domain.category.model.Category
import tachiyomi.domain.download.service.DownloadPreferences import tachiyomi.domain.download.service.DownloadPreferences
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.pluralStringResource
import tachiyomi.presentation.core.i18n.localizePlural import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
@ -47,16 +47,16 @@ object SettingsDownloadScreen : SearchableSettings {
getDownloadLocationPreference(downloadPreferences = downloadPreferences), getDownloadLocationPreference(downloadPreferences = downloadPreferences),
Preference.PreferenceItem.SwitchPreference( Preference.PreferenceItem.SwitchPreference(
pref = downloadPreferences.downloadOnlyOverWifi(), pref = downloadPreferences.downloadOnlyOverWifi(),
title = localize(MR.strings.connected_to_wifi), title = stringResource(MR.strings.connected_to_wifi),
), ),
Preference.PreferenceItem.SwitchPreference( Preference.PreferenceItem.SwitchPreference(
pref = downloadPreferences.saveChaptersAsCBZ(), pref = downloadPreferences.saveChaptersAsCBZ(),
title = localize(MR.strings.save_chapter_as_cbz), title = stringResource(MR.strings.save_chapter_as_cbz),
), ),
Preference.PreferenceItem.SwitchPreference( Preference.PreferenceItem.SwitchPreference(
pref = downloadPreferences.splitTallImages(), pref = downloadPreferences.splitTallImages(),
title = localize(MR.strings.split_tall_images), title = stringResource(MR.strings.split_tall_images),
subtitle = localize(MR.strings.split_tall_images_summary), subtitle = stringResource(MR.strings.split_tall_images_summary),
), ),
getDeleteChaptersGroup( getDeleteChaptersGroup(
downloadPreferences = downloadPreferences, downloadPreferences = downloadPreferences,
@ -97,15 +97,15 @@ object SettingsDownloadScreen : SearchableSettings {
return Preference.PreferenceItem.ListPreference( return Preference.PreferenceItem.ListPreference(
pref = currentDirPref, pref = currentDirPref,
title = localize(MR.strings.pref_download_directory), title = stringResource(MR.strings.pref_download_directory),
subtitleProvider = { value, _ -> subtitleProvider = { value, _ ->
remember(value) { remember(value) {
UniFile.fromUri(context, value.toUri())?.filePath UniFile.fromUri(context, value.toUri())?.filePath
} ?: localize(MR.strings.invalid_location, value) } ?: stringResource(MR.strings.invalid_location, value)
}, },
entries = mapOf( entries = mapOf(
defaultDirPair, defaultDirPair,
customDirEntryKey to localize(MR.strings.custom_dir), customDirEntryKey to stringResource(MR.strings.custom_dir),
), ),
onValueChanged = { onValueChanged = {
val default = it == defaultDirPair.first val default = it == defaultDirPair.first
@ -119,7 +119,7 @@ object SettingsDownloadScreen : SearchableSettings {
@Composable @Composable
private fun rememberDefaultDownloadDir(): Pair<String, String> { private fun rememberDefaultDownloadDir(): Pair<String, String> {
val appName = localize(MR.strings.app_name) val appName = stringResource(MR.strings.app_name)
return remember { return remember {
val file = UniFile.fromFile( val file = UniFile.fromFile(
File( File(
@ -137,27 +137,27 @@ object SettingsDownloadScreen : SearchableSettings {
categories: List<Category>, categories: List<Category>,
): Preference.PreferenceGroup { ): Preference.PreferenceGroup {
return Preference.PreferenceGroup( return Preference.PreferenceGroup(
title = localize(MR.strings.pref_category_delete_chapters), title = stringResource(MR.strings.pref_category_delete_chapters),
preferenceItems = listOf( preferenceItems = listOf(
Preference.PreferenceItem.SwitchPreference( Preference.PreferenceItem.SwitchPreference(
pref = downloadPreferences.removeAfterMarkedAsRead(), pref = downloadPreferences.removeAfterMarkedAsRead(),
title = localize(MR.strings.pref_remove_after_marked_as_read), title = stringResource(MR.strings.pref_remove_after_marked_as_read),
), ),
Preference.PreferenceItem.ListPreference( Preference.PreferenceItem.ListPreference(
pref = downloadPreferences.removeAfterReadSlots(), pref = downloadPreferences.removeAfterReadSlots(),
title = localize(MR.strings.pref_remove_after_read), title = stringResource(MR.strings.pref_remove_after_read),
entries = mapOf( entries = mapOf(
-1 to localize(MR.strings.disabled), -1 to stringResource(MR.strings.disabled),
0 to localize(MR.strings.last_read_chapter), 0 to stringResource(MR.strings.last_read_chapter),
1 to localize(MR.strings.second_to_last), 1 to stringResource(MR.strings.second_to_last),
2 to localize(MR.strings.third_to_last), 2 to stringResource(MR.strings.third_to_last),
3 to localize(MR.strings.fourth_to_last), 3 to stringResource(MR.strings.fourth_to_last),
4 to localize(MR.strings.fifth_to_last), 4 to stringResource(MR.strings.fifth_to_last),
), ),
), ),
Preference.PreferenceItem.SwitchPreference( Preference.PreferenceItem.SwitchPreference(
pref = downloadPreferences.removeBookmarkedChapters(), pref = downloadPreferences.removeBookmarkedChapters(),
title = localize(MR.strings.pref_remove_bookmarked_chapters), title = stringResource(MR.strings.pref_remove_bookmarked_chapters),
), ),
getExcludedCategoriesPreference( getExcludedCategoriesPreference(
downloadPreferences = downloadPreferences, downloadPreferences = downloadPreferences,
@ -174,7 +174,7 @@ object SettingsDownloadScreen : SearchableSettings {
): Preference.PreferenceItem.MultiSelectListPreference { ): Preference.PreferenceItem.MultiSelectListPreference {
return Preference.PreferenceItem.MultiSelectListPreference( return Preference.PreferenceItem.MultiSelectListPreference(
pref = downloadPreferences.removeExcludeCategories(), pref = downloadPreferences.removeExcludeCategories(),
title = localize(MR.strings.pref_remove_exclude_categories), title = stringResource(MR.strings.pref_remove_exclude_categories),
entries = categories().associate { it.id.toString() to it.visualName }, entries = categories().associate { it.id.toString() to it.visualName },
) )
} }
@ -195,8 +195,8 @@ object SettingsDownloadScreen : SearchableSettings {
var showDialog by rememberSaveable { mutableStateOf(false) } var showDialog by rememberSaveable { mutableStateOf(false) }
if (showDialog) { if (showDialog) {
TriStateListDialog( TriStateListDialog(
title = localize(MR.strings.categories), title = stringResource(MR.strings.categories),
message = localize(MR.strings.pref_download_new_categories_details), message = stringResource(MR.strings.pref_download_new_categories_details),
items = allCategories, items = allCategories,
initialChecked = included.mapNotNull { id -> allCategories.find { it.id.toString() == id } }, initialChecked = included.mapNotNull { id -> allCategories.find { it.id.toString() == id } },
initialInversed = excluded.mapNotNull { id -> allCategories.find { it.id.toString() == id } }, initialInversed = excluded.mapNotNull { id -> allCategories.find { it.id.toString() == id } },
@ -211,14 +211,14 @@ object SettingsDownloadScreen : SearchableSettings {
} }
return Preference.PreferenceGroup( return Preference.PreferenceGroup(
title = localize(MR.strings.pref_category_auto_download), title = stringResource(MR.strings.pref_category_auto_download),
preferenceItems = listOf( preferenceItems = listOf(
Preference.PreferenceItem.SwitchPreference( Preference.PreferenceItem.SwitchPreference(
pref = downloadNewChaptersPref, pref = downloadNewChaptersPref,
title = localize(MR.strings.pref_download_new), title = stringResource(MR.strings.pref_download_new),
), ),
Preference.PreferenceItem.TextPreference( Preference.PreferenceItem.TextPreference(
title = localize(MR.strings.categories), title = stringResource(MR.strings.categories),
subtitle = getCategoriesLabel( subtitle = getCategoriesLabel(
allCategories = allCategories, allCategories = allCategories,
included = included, included = included,
@ -236,20 +236,20 @@ object SettingsDownloadScreen : SearchableSettings {
downloadPreferences: DownloadPreferences, downloadPreferences: DownloadPreferences,
): Preference.PreferenceGroup { ): Preference.PreferenceGroup {
return Preference.PreferenceGroup( return Preference.PreferenceGroup(
title = localize(MR.strings.download_ahead), title = stringResource(MR.strings.download_ahead),
preferenceItems = listOf( preferenceItems = listOf(
Preference.PreferenceItem.ListPreference( Preference.PreferenceItem.ListPreference(
pref = downloadPreferences.autoDownloadWhileReading(), pref = downloadPreferences.autoDownloadWhileReading(),
title = localize(MR.strings.auto_download_while_reading), title = stringResource(MR.strings.auto_download_while_reading),
entries = listOf(0, 2, 3, 5, 10).associateWith { entries = listOf(0, 2, 3, 5, 10).associateWith {
if (it == 0) { if (it == 0) {
localize(MR.strings.disabled) stringResource(MR.strings.disabled)
} else { } else {
localizePlural(MR.plurals.next_unread_chapters, count = it, it) pluralStringResource(MR.plurals.next_unread_chapters, count = it, it)
} }
}, },
), ),
Preference.PreferenceItem.InfoPreference(localize(MR.strings.download_ahead_info)), Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.download_ahead_info)),
), ),
) )
} }

View File

@ -54,7 +54,7 @@ import eu.kanade.presentation.more.settings.Preference
import eu.kanade.presentation.util.Screen import eu.kanade.presentation.util.Screen
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.util.runOnEnterKeyPressed import tachiyomi.presentation.core.util.runOnEnterKeyPressed
import cafe.adriel.voyager.core.screen.Screen as VoyagerScreen import cafe.adriel.voyager.core.screen.Screen as VoyagerScreen
@ -118,7 +118,7 @@ class SettingsSearchScreen : Screen() {
decorationBox = { decorationBox = {
if (textFieldValue.text.isEmpty()) { if (textFieldValue.text.isEmpty()) {
Text( Text(
text = localize(MR.strings.action_search_settings), text = stringResource(MR.strings.action_search_settings),
color = MaterialTheme.colorScheme.onSurfaceVariant, color = MaterialTheme.colorScheme.onSurfaceVariant,
style = MaterialTheme.typography.bodyLarge, style = MaterialTheme.typography.bodyLarge,
) )
@ -215,7 +215,7 @@ private fun SearchResult(
when { when {
it == null -> {} it == null -> {}
it.isEmpty() -> { it.isEmpty() -> {
EmptyScreen(localize(MR.strings.no_results_found)) EmptyScreen(stringResource(MR.strings.no_results_found))
} }
else -> { else -> {
LazyColumn( LazyColumn(
@ -264,7 +264,7 @@ private fun getIndex() = settingScreens
// SY <-- // SY <--
.map { screen -> .map { screen ->
SettingsData( SettingsData(
title = localize(screen.getTitleRes()), title = stringResource(screen.getTitleRes()),
route = screen, route = screen,
contents = screen.getPreferences(), contents = screen.getPreferences(),
) )

View File

@ -56,7 +56,7 @@ import tachiyomi.core.util.lang.withUIContext
import tachiyomi.domain.source.service.SourceManager import tachiyomi.domain.source.service.SourceManager
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
@ -72,7 +72,7 @@ object SettingsTrackingScreen : SearchableSettings {
IconButton(onClick = { uriHandler.openUri("https://tachiyomi.org/docs/guides/tracking") }) { IconButton(onClick = { uriHandler.openUri("https://tachiyomi.org/docs/guides/tracking") }) {
Icon( Icon(
imageVector = Icons.AutoMirrored.Outlined.HelpOutline, imageVector = Icons.AutoMirrored.Outlined.HelpOutline,
contentDescription = localize(MR.strings.tracking_guide), contentDescription = stringResource(MR.strings.tracking_guide),
) )
} }
} }
@ -109,9 +109,9 @@ object SettingsTrackingScreen : SearchableSettings {
val acceptedSources = (service as EnhancedTracker).getAcceptedSources() val acceptedSources = (service as EnhancedTracker).getAcceptedSources()
sourceManager.getCatalogueSources().any { it::class.qualifiedName in acceptedSources } sourceManager.getCatalogueSources().any { it::class.qualifiedName in acceptedSources }
} }
var enhancedTrackerInfo = localize(MR.strings.enhanced_tracking_info) var enhancedTrackerInfo = stringResource(MR.strings.enhanced_tracking_info)
if (enhancedTrackers.second.isNotEmpty()) { if (enhancedTrackers.second.isNotEmpty()) {
val missingSourcesInfo = localize( val missingSourcesInfo = stringResource(
MR.strings.enhanced_services_not_installed, MR.strings.enhanced_services_not_installed,
enhancedTrackers.second.joinToString { it.name }, enhancedTrackers.second.joinToString { it.name },
) )
@ -121,10 +121,10 @@ object SettingsTrackingScreen : SearchableSettings {
return listOf( return listOf(
Preference.PreferenceItem.SwitchPreference( Preference.PreferenceItem.SwitchPreference(
pref = trackPreferences.autoUpdateTrack(), pref = trackPreferences.autoUpdateTrack(),
title = localize(MR.strings.pref_auto_update_manga_sync), title = stringResource(MR.strings.pref_auto_update_manga_sync),
), ),
Preference.PreferenceGroup( Preference.PreferenceGroup(
title = localize(MR.strings.services), title = stringResource(MR.strings.services),
preferenceItems = listOf( preferenceItems = listOf(
Preference.PreferenceItem.TrackerPreference( Preference.PreferenceItem.TrackerPreference(
title = trackerManager.myAnimeList.name, title = trackerManager.myAnimeList.name,
@ -162,11 +162,11 @@ object SettingsTrackingScreen : SearchableSettings {
login = { context.openInBrowser(BangumiApi.authUrl(), forceDefaultBrowser = true) }, login = { context.openInBrowser(BangumiApi.authUrl(), forceDefaultBrowser = true) },
logout = { dialog = LogoutDialog(trackerManager.bangumi) }, logout = { dialog = LogoutDialog(trackerManager.bangumi) },
), ),
Preference.PreferenceItem.InfoPreference(localize(MR.strings.tracking_info)), Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.tracking_info)),
), ),
), ),
Preference.PreferenceGroup( Preference.PreferenceGroup(
title = localize(MR.strings.enhanced_services), title = stringResource(MR.strings.enhanced_services),
preferenceItems = enhancedTrackers.first preferenceItems = enhancedTrackers.first
.map { service -> .map { service ->
Preference.PreferenceItem.TrackerPreference( Preference.PreferenceItem.TrackerPreference(
@ -199,13 +199,13 @@ object SettingsTrackingScreen : SearchableSettings {
title = { title = {
Row(verticalAlignment = Alignment.CenterVertically) { Row(verticalAlignment = Alignment.CenterVertically) {
Text( Text(
text = localize(MR.strings.login_title, tracker.name), text = stringResource(MR.strings.login_title, tracker.name),
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
) )
IconButton(onClick = onDismissRequest) { IconButton(onClick = onDismissRequest) {
Icon( Icon(
imageVector = Icons.Outlined.Close, imageVector = Icons.Outlined.Close,
contentDescription = localize(MR.strings.action_close), contentDescription = stringResource(MR.strings.action_close),
) )
} }
} }
@ -216,7 +216,7 @@ object SettingsTrackingScreen : SearchableSettings {
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
value = username, value = username,
onValueChange = { username = it }, onValueChange = { username = it },
label = { Text(text = localize(uNameStringRes)) }, label = { Text(text = stringResource(uNameStringRes)) },
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next), keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next),
singleLine = true, singleLine = true,
isError = inputError && !processing, isError = inputError && !processing,
@ -227,7 +227,7 @@ object SettingsTrackingScreen : SearchableSettings {
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
value = password, value = password,
onValueChange = { password = it }, onValueChange = { password = it },
label = { Text(text = localize(MR.strings.password)) }, label = { Text(text = stringResource(MR.strings.password)) },
trailingIcon = { trailingIcon = {
IconButton(onClick = { hidePassword = !hidePassword }) { IconButton(onClick = { hidePassword = !hidePassword }) {
Icon( Icon(
@ -274,7 +274,7 @@ object SettingsTrackingScreen : SearchableSettings {
}, },
) { ) {
val id = if (processing) MR.strings.loading else MR.strings.login val id = if (processing) MR.strings.loading else MR.strings.login
Text(text = localize(id)) Text(text = stringResource(id))
} }
}, },
) )
@ -307,7 +307,7 @@ object SettingsTrackingScreen : SearchableSettings {
onDismissRequest = onDismissRequest, onDismissRequest = onDismissRequest,
title = { title = {
Text( Text(
text = localize(MR.strings.logout_title, tracker.name), text = stringResource(MR.strings.logout_title, tracker.name),
textAlign = TextAlign.Center, textAlign = TextAlign.Center,
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
) )
@ -318,7 +318,7 @@ object SettingsTrackingScreen : SearchableSettings {
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
onClick = onDismissRequest, onClick = onDismissRequest,
) { ) {
Text(text = localize(MR.strings.action_cancel)) Text(text = stringResource(MR.strings.action_cancel))
} }
Button( Button(
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
@ -332,7 +332,7 @@ object SettingsTrackingScreen : SearchableSettings {
contentColor = MaterialTheme.colorScheme.onError, contentColor = MaterialTheme.colorScheme.onError,
), ),
) { ) {
Text(text = localize(MR.strings.logout)) Text(text = stringResource(MR.strings.logout))
} }
} }
}, },

View File

@ -21,7 +21,7 @@ import eu.kanade.presentation.util.Screen
import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
class OpenSourceLibraryLicenseScreen( class OpenSourceLibraryLicenseScreen(
private val name: String, private val name: String,
@ -44,7 +44,7 @@ class OpenSourceLibraryLicenseScreen(
AppBarActions( AppBarActions(
persistentListOf( persistentListOf(
AppBar.Action( AppBar.Action(
title = localize(MR.strings.website), title = stringResource(MR.strings.website),
icon = Icons.Default.Public, icon = Icons.Default.Public,
onClick = { uriHandler.openUri(website) }, onClick = { uriHandler.openUri(website) },
), ),

View File

@ -13,7 +13,7 @@ import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.util.Screen import eu.kanade.presentation.util.Screen
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
class OpenSourceLicensesScreen : Screen() { class OpenSourceLicensesScreen : Screen() {
@ -23,7 +23,7 @@ class OpenSourceLicensesScreen : Screen() {
Scaffold( Scaffold(
topBar = { scrollBehavior -> topBar = { scrollBehavior ->
AppBar( AppBar(
title = localize(MR.strings.licenses), title = stringResource(MR.strings.licenses),
navigateUp = navigator::pop, navigateUp = navigator::pop,
scrollBehavior = scrollBehavior, scrollBehavior = scrollBehavior,
) )

View File

@ -23,7 +23,7 @@ import kotlinx.collections.immutable.persistentListOf
import kotlinx.serialization.protobuf.schema.ProtoBufSchemaGenerator import kotlinx.serialization.protobuf.schema.ProtoBufSchemaGenerator
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
class BackupSchemaScreen : Screen() { class BackupSchemaScreen : Screen() {
@ -47,7 +47,7 @@ class BackupSchemaScreen : Screen() {
AppBarActions( AppBarActions(
persistentListOf( persistentListOf(
AppBar.Action( AppBar.Action(
title = localize(MR.strings.action_copy_to_clipboard), title = stringResource(MR.strings.action_copy_to_clipboard),
icon = Icons.Default.ContentCopy, icon = Icons.Default.ContentCopy,
onClick = { onClick = {
context.copyToClipboard(title, schema) context.copyToClipboard(title, schema)

View File

@ -37,7 +37,7 @@ import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.stateIn
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.plus import tachiyomi.presentation.core.util.plus
class WorkerInfoScreen : Screen() { class WorkerInfoScreen : Screen() {
@ -65,7 +65,7 @@ class WorkerInfoScreen : Screen() {
AppBarActions( AppBarActions(
persistentListOf( persistentListOf(
AppBar.Action( AppBar.Action(
title = localize(MR.strings.action_copy_to_clipboard), title = stringResource(MR.strings.action_copy_to_clipboard),
icon = Icons.Default.ContentCopy, icon = Icons.Default.ContentCopy,
onClick = { onClick = {
context.copyToClipboard(title, enqueued + finished + running) context.copyToClipboard(title, enqueued + finished + running)

View File

@ -46,7 +46,7 @@ import eu.kanade.tachiyomi.util.system.DeviceUtil
import eu.kanade.tachiyomi.util.system.isDynamicColorAvailable import eu.kanade.tachiyomi.util.system.isDynamicColorAvailable
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.secondaryItemAlpha import tachiyomi.presentation.core.util.secondaryItemAlpha
@Composable @Composable
@ -104,7 +104,7 @@ private fun AppThemesList(
Spacer(modifier = Modifier.height(8.dp)) Spacer(modifier = Modifier.height(8.dp))
Text( Text(
text = localize(appTheme.titleRes!!), text = stringResource(appTheme.titleRes!!),
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.secondaryItemAlpha(), .secondaryItemAlpha(),
@ -167,7 +167,7 @@ fun AppThemePreviewItem(
if (selected) { if (selected) {
Icon( Icon(
imageVector = Icons.Filled.CheckCircle, imageVector = Icons.Filled.CheckCircle,
contentDescription = localize(MR.strings.selected), contentDescription = stringResource(MR.strings.selected),
tint = MaterialTheme.colorScheme.primary, tint = MaterialTheme.colorScheme.primary,
) )
} }

View File

@ -23,7 +23,7 @@ import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.window.DialogProperties import androidx.compose.ui.window.DialogProperties
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun EditTextPreferenceWidget( fun EditTextPreferenceWidget(
@ -83,12 +83,12 @@ fun EditTextPreferenceWidget(
} }
}, },
) { ) {
Text(text = localize(MR.strings.action_ok)) Text(text = stringResource(MR.strings.action_ok))
} }
}, },
dismissButton = { dismissButton = {
TextButton(onClick = onDismissRequest) { TextButton(onClick = onDismissRequest) {
Text(text = localize(MR.strings.action_cancel)) Text(text = stringResource(MR.strings.action_cancel))
} }
}, },
) )

View File

@ -15,7 +15,7 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark
import eu.kanade.presentation.theme.TachiyomiTheme import eu.kanade.presentation.theme.TachiyomiTheme
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.secondaryItemAlpha import tachiyomi.presentation.core.util.secondaryItemAlpha
@Composable @Composable
@ -45,7 +45,7 @@ internal fun InfoWidget(text: String) {
private fun InfoWidgetPreview() { private fun InfoWidgetPreview() {
TachiyomiTheme { TachiyomiTheme {
Surface { Surface {
InfoWidget(text = localize(MR.strings.download_ahead_info)) InfoWidget(text = stringResource(MR.strings.download_ahead_info))
} }
} }
} }

View File

@ -25,7 +25,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.ScrollbarLazyColumn import tachiyomi.presentation.core.components.ScrollbarLazyColumn
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.isScrolledToEnd import tachiyomi.presentation.core.util.isScrolledToEnd
import tachiyomi.presentation.core.util.isScrolledToStart import tachiyomi.presentation.core.util.isScrolledToStart
@ -75,7 +75,7 @@ fun <T> ListPreferenceWidget(
}, },
confirmButton = { confirmButton = {
TextButton(onClick = { isDialogShown = false }) { TextButton(onClick = { isDialogShown = false }) {
Text(text = localize(MR.strings.action_cancel)) Text(text = stringResource(MR.strings.action_cancel))
} }
}, },
) )

View File

@ -14,7 +14,7 @@ import androidx.compose.ui.window.DialogProperties
import eu.kanade.presentation.more.settings.Preference import eu.kanade.presentation.more.settings.Preference
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.LabeledCheckbox import tachiyomi.presentation.core.components.LabeledCheckbox
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun MultiSelectListPreferenceWidget( fun MultiSelectListPreferenceWidget(
@ -70,12 +70,12 @@ fun MultiSelectListPreferenceWidget(
isDialogShown = false isDialogShown = false
}, },
) { ) {
Text(text = localize(MR.strings.action_ok)) Text(text = stringResource(MR.strings.action_ok))
} }
}, },
dismissButton = { dismissButton = {
TextButton(onClick = { isDialogShown = false }) { TextButton(onClick = { isDialogShown = false }) {
Text(text = localize(MR.strings.action_cancel)) Text(text = stringResource(MR.strings.action_cancel))
} }
}, },
) )

View File

@ -20,7 +20,7 @@ import eu.kanade.presentation.more.settings.LocalPreferenceHighlighted
import eu.kanade.presentation.track.components.TrackLogoIcon import eu.kanade.presentation.track.components.TrackLogoIcon
import eu.kanade.tachiyomi.data.track.Tracker import eu.kanade.tachiyomi.data.track.Tracker
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun TrackingPreferenceWidget( fun TrackingPreferenceWidget(
@ -55,7 +55,7 @@ fun TrackingPreferenceWidget(
.padding(4.dp) .padding(4.dp)
.size(32.dp), .size(32.dp),
tint = Color(0xFF4CAF50), tint = Color(0xFF4CAF50),
contentDescription = localize(MR.strings.login_success), contentDescription = stringResource(MR.strings.login_success),
) )
} }
} }

View File

@ -29,7 +29,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.isScrolledToEnd import tachiyomi.presentation.core.util.isScrolledToEnd
import tachiyomi.presentation.core.util.isScrolledToStart import tachiyomi.presentation.core.util.isScrolledToStart
@ -102,7 +102,7 @@ fun <T> TriStateListDialog(
} else { } else {
MaterialTheme.colorScheme.primary MaterialTheme.colorScheme.primary
}, },
contentDescription = localize( contentDescription = stringResource(
when (state) { when (state) {
State.UNCHECKED -> MR.strings.not_selected State.UNCHECKED -> MR.strings.not_selected
State.CHECKED -> MR.strings.selected State.CHECKED -> MR.strings.selected
@ -130,7 +130,7 @@ fun <T> TriStateListDialog(
}, },
dismissButton = { dismissButton = {
TextButton(onClick = onDismissRequest) { TextButton(onClick = onDismissRequest) {
Text(text = localize(MR.strings.action_cancel)) Text(text = stringResource(MR.strings.action_cancel))
} }
}, },
confirmButton = { confirmButton = {
@ -145,7 +145,7 @@ fun <T> TriStateListDialog(
onValueChanged(included, excluded) onValueChanged(included, excluded)
}, },
) { ) {
Text(text = localize(MR.strings.action_ok)) Text(text = stringResource(MR.strings.action_ok))
} }
}, },
) )

View File

@ -20,7 +20,7 @@ import eu.kanade.presentation.more.stats.data.StatsData
import eu.kanade.presentation.util.toDurationString import eu.kanade.presentation.util.toDurationString
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import java.util.Locale import java.util.Locale
import kotlin.time.DurationUnit import kotlin.time.DurationUnit
import kotlin.time.toDuration import kotlin.time.toDuration
@ -55,7 +55,7 @@ fun StatsScreenContent(
private fun OverviewSection( private fun OverviewSection(
data: StatsData.Overview, data: StatsData.Overview,
) { ) {
val none = localize(MR.strings.none) val none = stringResource(MR.strings.none)
val context = LocalContext.current val context = LocalContext.current
val readDurationString = remember(data.totalReadDuration) { val readDurationString = remember(data.totalReadDuration) {
data.totalReadDuration data.totalReadDuration
@ -66,17 +66,17 @@ private fun OverviewSection(
Row { Row {
StatsOverviewItem( StatsOverviewItem(
title = data.libraryMangaCount.toString(), title = data.libraryMangaCount.toString(),
subtitle = localize(MR.strings.in_library), subtitle = stringResource(MR.strings.in_library),
icon = Icons.Outlined.CollectionsBookmark, icon = Icons.Outlined.CollectionsBookmark,
) )
StatsOverviewItem( StatsOverviewItem(
title = data.completedMangaCount.toString(), title = data.completedMangaCount.toString(),
subtitle = localize(MR.strings.label_completed_titles), subtitle = stringResource(MR.strings.label_completed_titles),
icon = Icons.Outlined.LocalLibrary, icon = Icons.Outlined.LocalLibrary,
) )
StatsOverviewItem( StatsOverviewItem(
title = readDurationString, title = readDurationString,
subtitle = localize(MR.strings.label_read_duration), subtitle = stringResource(MR.strings.label_read_duration),
icon = Icons.Outlined.Schedule, icon = Icons.Outlined.Schedule,
) )
} }
@ -91,15 +91,15 @@ private fun TitlesStats(
Row { Row {
StatsItem( StatsItem(
data.globalUpdateItemCount.toString(), data.globalUpdateItemCount.toString(),
localize(MR.strings.label_titles_in_global_update), stringResource(MR.strings.label_titles_in_global_update),
) )
StatsItem( StatsItem(
data.startedMangaCount.toString(), data.startedMangaCount.toString(),
localize(MR.strings.label_started), stringResource(MR.strings.label_started),
) )
StatsItem( StatsItem(
data.localMangaCount.toString(), data.localMangaCount.toString(),
localize(MR.strings.label_local), stringResource(MR.strings.label_local),
) )
} }
} }
@ -113,15 +113,15 @@ private fun ChapterStats(
Row { Row {
StatsItem( StatsItem(
data.totalChapterCount.toString(), data.totalChapterCount.toString(),
localize(MR.strings.label_total_chapters), stringResource(MR.strings.label_total_chapters),
) )
StatsItem( StatsItem(
data.readChapterCount.toString(), data.readChapterCount.toString(),
localize(MR.strings.label_read_chapters), stringResource(MR.strings.label_read_chapters),
) )
StatsItem( StatsItem(
data.downloadCount.toString(), data.downloadCount.toString(),
localize(MR.strings.label_downloaded), stringResource(MR.strings.label_downloaded),
) )
} }
} }
@ -131,7 +131,7 @@ private fun ChapterStats(
private fun TrackerStats( private fun TrackerStats(
data: StatsData.Trackers, data: StatsData.Trackers,
) { ) {
val notApplicable = localize(MR.strings.not_applicable) val notApplicable = stringResource(MR.strings.not_applicable)
val meanScoreStr = remember(data.trackedTitleCount, data.meanScore) { val meanScoreStr = remember(data.trackedTitleCount, data.meanScore) {
if (data.trackedTitleCount > 0 && !data.meanScore.isNaN()) { if (data.trackedTitleCount > 0 && !data.meanScore.isNaN()) {
// All other numbers are localized in English // All other numbers are localized in English
@ -144,15 +144,15 @@ private fun TrackerStats(
Row { Row {
StatsItem( StatsItem(
data.trackedTitleCount.toString(), data.trackedTitleCount.toString(),
localize(MR.strings.label_tracked_titles), stringResource(MR.strings.label_tracked_titles),
) )
StatsItem( StatsItem(
meanScoreStr, meanScoreStr,
localize(MR.strings.label_mean_score), stringResource(MR.strings.label_mean_score),
) )
StatsItem( StatsItem(
data.trackerCount.toString(), data.trackerCount.toString(),
localize(MR.strings.label_used), stringResource(MR.strings.label_used),
) )
} }
} }

View File

@ -10,7 +10,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import dev.icerock.moko.resources.StringResource import dev.icerock.moko.resources.StringResource
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun StatsSection( fun StatsSection(
@ -19,7 +19,7 @@ fun StatsSection(
) { ) {
Text( Text(
modifier = Modifier.padding(horizontal = MaterialTheme.padding.extraLarge), modifier = Modifier.padding(horizontal = MaterialTheme.padding.extraLarge),
text = localize(titleRes), text = stringResource(titleRes),
style = MaterialTheme.typography.titleSmall, style = MaterialTheme.typography.titleSmall,
) )
ElevatedCard( ElevatedCard(

View File

@ -41,8 +41,8 @@ import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition
import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter
import tachiyomi.domain.chapter.service.calculateChapterGap import tachiyomi.domain.chapter.service.calculateChapterGap
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.pluralStringResource
import tachiyomi.presentation.core.i18n.localizePlural import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.secondaryItemAlpha import tachiyomi.presentation.core.util.secondaryItemAlpha
@Composable @Composable
@ -58,25 +58,25 @@ fun ChapterTransition(
when (transition) { when (transition) {
is ChapterTransition.Prev -> { is ChapterTransition.Prev -> {
TransitionText( TransitionText(
topLabel = localize(MR.strings.transition_previous), topLabel = stringResource(MR.strings.transition_previous),
topChapter = goingToChapter, topChapter = goingToChapter,
topChapterDownloaded = goingToChapterDownloaded, topChapterDownloaded = goingToChapterDownloaded,
bottomLabel = localize(MR.strings.transition_current), bottomLabel = stringResource(MR.strings.transition_current),
bottomChapter = currChapter, bottomChapter = currChapter,
bottomChapterDownloaded = currChapterDownloaded, bottomChapterDownloaded = currChapterDownloaded,
fallbackLabel = localize(MR.strings.transition_no_previous), fallbackLabel = stringResource(MR.strings.transition_no_previous),
chapterGap = calculateChapterGap(currChapter.toDomainChapter(), goingToChapter?.toDomainChapter()), chapterGap = calculateChapterGap(currChapter.toDomainChapter(), goingToChapter?.toDomainChapter()),
) )
} }
is ChapterTransition.Next -> { is ChapterTransition.Next -> {
TransitionText( TransitionText(
topLabel = localize(MR.strings.transition_finished), topLabel = stringResource(MR.strings.transition_finished),
topChapter = currChapter, topChapter = currChapter,
topChapterDownloaded = currChapterDownloaded, topChapterDownloaded = currChapterDownloaded,
bottomLabel = localize(MR.strings.transition_next), bottomLabel = stringResource(MR.strings.transition_next),
bottomChapter = goingToChapter, bottomChapter = goingToChapter,
bottomChapterDownloaded = goingToChapterDownloaded, bottomChapterDownloaded = goingToChapterDownloaded,
fallbackLabel = localize(MR.strings.transition_no_next), fallbackLabel = stringResource(MR.strings.transition_no_next),
chapterGap = calculateChapterGap(goingToChapter?.toDomainChapter(), currChapter.toDomainChapter()), chapterGap = calculateChapterGap(goingToChapter?.toDomainChapter(), currChapter.toDomainChapter()),
) )
} }
@ -191,7 +191,7 @@ private fun ChapterGapWarning(
) )
Text( 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, style = MaterialTheme.typography.bodyMedium,
) )
} }
@ -245,7 +245,7 @@ private fun ChapterText(
) { ) {
Icon( Icon(
imageVector = Icons.Filled.CheckCircle, 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.i18n.MR
import tachiyomi.presentation.core.components.SettingsIconGrid import tachiyomi.presentation.core.components.SettingsIconGrid
import tachiyomi.presentation.core.components.material.IconToggleButton 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 private val ReaderOrientationsWithoutDefault = ReaderOrientation.entries - ReaderOrientation.DEFAULT
@ -73,7 +73,7 @@ private fun DialogContent(
}, },
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
imageVector = ImageVector.vectorResource(mode.iconRes), imageVector = ImageVector.vectorResource(mode.iconRes),
title = localize(mode.stringRes), title = stringResource(mode.stringRes),
) )
} }
} }

View File

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

View File

@ -21,7 +21,7 @@ import androidx.compose.ui.unit.dp
import eu.kanade.presentation.theme.TachiyomiTheme import eu.kanade.presentation.theme.TachiyomiTheme
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.SettingsItemsPaddings import tachiyomi.presentation.core.components.SettingsItemsPaddings
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun ModeSelectionDialog( fun ModeSelectionDialog(
@ -40,7 +40,7 @@ fun ModeSelectionDialog(
) { ) {
onUseDefault?.let { onUseDefault?.let {
OutlinedButton(onClick = it) { 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, imageVector = Icons.Outlined.Check,
contentDescription = null, 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.CheckboxItem
import tachiyomi.presentation.core.components.SettingsChipRow import tachiyomi.presentation.core.components.SettingsChipRow
import tachiyomi.presentation.core.components.SliderItem 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 tachiyomi.presentation.core.util.collectAsState
@Composable @Composable
@ -38,11 +38,11 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
), ),
) )
} }
}.map { localize(it) } }.map { stringResource(it) }
val customBrightness by screenModel.preferences.customBrightness().collectAsState() val customBrightness by screenModel.preferences.customBrightness().collectAsState()
CheckboxItem( CheckboxItem(
label = localize(MR.strings.pref_custom_brightness), label = stringResource(MR.strings.pref_custom_brightness),
pref = screenModel.preferences.customBrightness(), pref = screenModel.preferences.customBrightness(),
) )
@ -55,7 +55,7 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
if (customBrightness) { if (customBrightness) {
val customBrightnessValue by screenModel.preferences.customBrightnessValue().collectAsState() val customBrightnessValue by screenModel.preferences.customBrightnessValue().collectAsState()
SliderItem( SliderItem(
label = localize(MR.strings.pref_custom_brightness), label = stringResource(MR.strings.pref_custom_brightness),
min = -75, min = -75,
max = 100, max = 100,
value = customBrightnessValue, value = customBrightnessValue,
@ -66,13 +66,13 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
val colorFilter by screenModel.preferences.colorFilter().collectAsState() val colorFilter by screenModel.preferences.colorFilter().collectAsState()
CheckboxItem( CheckboxItem(
label = localize(MR.strings.pref_custom_color_filter), label = stringResource(MR.strings.pref_custom_color_filter),
pref = screenModel.preferences.colorFilter(), pref = screenModel.preferences.colorFilter(),
) )
if (colorFilter) { if (colorFilter) {
val colorFilterValue by screenModel.preferences.colorFilterValue().collectAsState() val colorFilterValue by screenModel.preferences.colorFilterValue().collectAsState()
SliderItem( SliderItem(
label = localize(MR.strings.color_filter_r_value), label = stringResource(MR.strings.color_filter_r_value),
max = 255, max = 255,
value = colorFilterValue.red, value = colorFilterValue.red,
valueText = colorFilterValue.red.toString(), valueText = colorFilterValue.red.toString(),
@ -83,7 +83,7 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
}, },
) )
SliderItem( SliderItem(
label = localize(MR.strings.color_filter_g_value), label = stringResource(MR.strings.color_filter_g_value),
max = 255, max = 255,
value = colorFilterValue.green, value = colorFilterValue.green,
valueText = colorFilterValue.green.toString(), valueText = colorFilterValue.green.toString(),
@ -94,7 +94,7 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
}, },
) )
SliderItem( SliderItem(
label = localize(MR.strings.color_filter_b_value), label = stringResource(MR.strings.color_filter_b_value),
max = 255, max = 255,
value = colorFilterValue.blue, value = colorFilterValue.blue,
valueText = colorFilterValue.blue.toString(), valueText = colorFilterValue.blue.toString(),
@ -105,7 +105,7 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
}, },
) )
SliderItem( SliderItem(
label = localize(MR.strings.color_filter_a_value), label = stringResource(MR.strings.color_filter_a_value),
max = 255, max = 255,
value = colorFilterValue.alpha, value = colorFilterValue.alpha,
valueText = colorFilterValue.alpha.toString(), valueText = colorFilterValue.alpha.toString(),
@ -129,11 +129,11 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
} }
CheckboxItem( CheckboxItem(
label = localize(MR.strings.pref_grayscale), label = stringResource(MR.strings.pref_grayscale),
pref = screenModel.preferences.grayscale(), pref = screenModel.preferences.grayscale(),
) )
CheckboxItem( CheckboxItem(
label = localize(MR.strings.pref_inverted_colors), label = stringResource(MR.strings.pref_inverted_colors),
pref = screenModel.preferences.invertedColors(), pref = screenModel.preferences.invertedColors(),
) )
} }

View File

@ -17,7 +17,7 @@ import eu.kanade.presentation.components.TabbedDialogPaddings
import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun ReaderSettingsDialog( fun ReaderSettingsDialog(
@ -27,9 +27,9 @@ fun ReaderSettingsDialog(
screenModel: ReaderSettingsScreenModel, screenModel: ReaderSettingsScreenModel,
) { ) {
val tabTitles = persistentListOf( val tabTitles = persistentListOf(
localize(MR.strings.pref_category_reading_mode), stringResource(MR.strings.pref_category_reading_mode),
localize(MR.strings.pref_category_general), stringResource(MR.strings.pref_category_general),
localize(MR.strings.custom_filter), stringResource(MR.strings.custom_filter),
) )
val pagerState = rememberPagerState { tabTitles.size } 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.HeadingItem
import tachiyomi.presentation.core.components.SettingsChipRow import tachiyomi.presentation.core.components.SettingsChipRow
import tachiyomi.presentation.core.components.SliderItem 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 tachiyomi.presentation.core.util.collectAsState
import java.text.NumberFormat import java.text.NumberFormat
@ -34,7 +34,7 @@ internal fun ColumnScope.ReadingModePage(screenModel: ReaderSettingsScreenModel)
FilterChip( FilterChip(
selected = it == readingMode, selected = it == readingMode,
onClick = { screenModel.onChangeReadingMode(it) }, 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( FilterChip(
selected = it == orientation, selected = it == orientation,
onClick = { screenModel.onChangeOrientation(it) }, onClick = { screenModel.onChangeOrientation(it) },
label = { Text(localize(it.stringRes)) }, label = { Text(stringResource(it.stringRes)) },
) )
} }
} }
@ -80,7 +80,7 @@ private fun ColumnScope.PagerViewerSettings(screenModel: ReaderSettingsScreenMod
FilterChip( FilterChip(
selected = imageScaleType == index + 1, selected = imageScaleType == index + 1,
onClick = { screenModel.preferences.imageScaleType().set(index + 1) }, onClick = { screenModel.preferences.imageScaleType().set(index + 1) },
label = { Text(localize(it)) }, label = { Text(stringResource(it)) },
) )
} }
} }
@ -91,7 +91,7 @@ private fun ColumnScope.PagerViewerSettings(screenModel: ReaderSettingsScreenMod
FilterChip( FilterChip(
selected = zoomStart == index + 1, selected = zoomStart == index + 1,
onClick = { screenModel.preferences.zoomStart().set(index + 1) }, onClick = { screenModel.preferences.zoomStart().set(index + 1) },
label = { Text(localize(it)) }, label = { Text(stringResource(it)) },
) )
} }
} }
@ -110,42 +110,42 @@ private fun ColumnScope.PagerViewerSettings(screenModel: ReaderSettingsScreenMod
// SY <-- // SY <--
CheckboxItem( CheckboxItem(
label = localize(MR.strings.pref_crop_borders), label = stringResource(MR.strings.pref_crop_borders),
pref = screenModel.preferences.cropBorders(), pref = screenModel.preferences.cropBorders(),
) )
CheckboxItem( CheckboxItem(
label = localize(MR.strings.pref_landscape_zoom), label = stringResource(MR.strings.pref_landscape_zoom),
pref = screenModel.preferences.landscapeZoom(), pref = screenModel.preferences.landscapeZoom(),
) )
CheckboxItem( CheckboxItem(
label = localize(MR.strings.pref_navigate_pan), label = stringResource(MR.strings.pref_navigate_pan),
pref = screenModel.preferences.navigateToPan(), pref = screenModel.preferences.navigateToPan(),
) )
val dualPageSplitPaged by screenModel.preferences.dualPageSplitPaged().collectAsState() val dualPageSplitPaged by screenModel.preferences.dualPageSplitPaged().collectAsState()
CheckboxItem( CheckboxItem(
label = localize(MR.strings.pref_dual_page_split), label = stringResource(MR.strings.pref_dual_page_split),
pref = screenModel.preferences.dualPageSplitPaged(), pref = screenModel.preferences.dualPageSplitPaged(),
) )
if (dualPageSplitPaged) { if (dualPageSplitPaged) {
CheckboxItem( CheckboxItem(
label = localize(MR.strings.pref_dual_page_invert), label = stringResource(MR.strings.pref_dual_page_invert),
pref = screenModel.preferences.dualPageInvertPaged(), pref = screenModel.preferences.dualPageInvertPaged(),
) )
} }
val dualPageRotateToFit by screenModel.preferences.dualPageRotateToFit().collectAsState() val dualPageRotateToFit by screenModel.preferences.dualPageRotateToFit().collectAsState()
CheckboxItem( CheckboxItem(
label = localize(MR.strings.pref_page_rotate), label = stringResource(MR.strings.pref_page_rotate),
pref = screenModel.preferences.dualPageRotateToFit(), pref = screenModel.preferences.dualPageRotateToFit(),
) )
if (dualPageRotateToFit) { if (dualPageRotateToFit) {
CheckboxItem( CheckboxItem(
label = localize(MR.strings.pref_page_rotate_invert), label = stringResource(MR.strings.pref_page_rotate_invert),
pref = screenModel.preferences.dualPageRotateToFitInvert(), pref = screenModel.preferences.dualPageRotateToFitInvert(),
) )
} }
@ -191,7 +191,7 @@ private fun ColumnScope.WebtoonViewerSettings(screenModel: ReaderSettingsScreenM
val webtoonSidePadding by screenModel.preferences.webtoonSidePadding().collectAsState() val webtoonSidePadding by screenModel.preferences.webtoonSidePadding().collectAsState()
SliderItem( SliderItem(
label = localize(MR.strings.pref_webtoon_side_padding), label = stringResource(MR.strings.pref_webtoon_side_padding),
min = ReaderPreferences.WEBTOON_PADDING_MIN, min = ReaderPreferences.WEBTOON_PADDING_MIN,
max = ReaderPreferences.WEBTOON_PADDING_MAX, max = ReaderPreferences.WEBTOON_PADDING_MAX,
value = webtoonSidePadding, value = webtoonSidePadding,
@ -202,7 +202,7 @@ private fun ColumnScope.WebtoonViewerSettings(screenModel: ReaderSettingsScreenM
) )
CheckboxItem( CheckboxItem(
label = localize(MR.strings.pref_crop_borders), label = stringResource(MR.strings.pref_crop_borders),
pref = screenModel.preferences.cropBordersWebtoon(), pref = screenModel.preferences.cropBordersWebtoon(),
) )
@ -225,19 +225,19 @@ private fun ColumnScope.WebtoonViewerSettings(screenModel: ReaderSettingsScreenM
val dualPageSplitWebtoon by screenModel.preferences.dualPageSplitWebtoon().collectAsState() val dualPageSplitWebtoon by screenModel.preferences.dualPageSplitWebtoon().collectAsState()
CheckboxItem( CheckboxItem(
label = localize(MR.strings.pref_dual_page_split), label = stringResource(MR.strings.pref_dual_page_split),
pref = screenModel.preferences.dualPageSplitWebtoon(), pref = screenModel.preferences.dualPageSplitWebtoon(),
) )
if (dualPageSplitWebtoon) { if (dualPageSplitWebtoon) {
CheckboxItem( CheckboxItem(
label = localize(MR.strings.pref_dual_page_invert), label = stringResource(MR.strings.pref_dual_page_invert),
pref = screenModel.preferences.dualPageInvertWebtoon(), pref = screenModel.preferences.dualPageInvertWebtoon(),
) )
} }
CheckboxItem( CheckboxItem(
label = localize(MR.strings.pref_double_tap_zoom), label = stringResource(MR.strings.pref_double_tap_zoom),
pref = screenModel.preferences.webtoonDoubleTapZoomEnabled(), pref = screenModel.preferences.webtoonDoubleTapZoomEnabled(),
) )
} }
@ -266,7 +266,7 @@ private fun ColumnScope.TapZonesItems(
FilterChip( FilterChip(
selected = selected == index, selected = selected == index,
onClick = { onSelect(index) }, onClick = { onSelect(index) },
label = { Text(localize(it)) }, label = { Text(stringResource(it)) },
) )
} }
} }
@ -277,7 +277,7 @@ private fun ColumnScope.TapZonesItems(
FilterChip( FilterChip(
selected = it == invertMode, selected = it == invertMode,
onClick = { onSelectInvertMode(it) }, onClick = { onSelectInvertMode(it) },
label = { Text(localize(it.titleRes)) }, label = { Text(stringResource(it.titleRes)) },
) )
} }
} }

View File

@ -55,7 +55,7 @@ import eu.kanade.tachiyomi.data.track.Tracker
import eu.kanade.tachiyomi.ui.manga.track.TrackItem import eu.kanade.tachiyomi.ui.manga.track.TrackItem
import eu.kanade.tachiyomi.util.system.copyToClipboard import eu.kanade.tachiyomi.util.system.copyToClipboard
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import java.text.DateFormat import java.text.DateFormat
private const val UnsetStatusTextAlpha = 0.5F private const val UnsetStatusTextAlpha = 0.5F
@ -194,7 +194,7 @@ private fun TrackInfoItem(
Row(modifier = Modifier.height(IntrinsicSize.Min)) { Row(modifier = Modifier.height(IntrinsicSize.Min)) {
TrackDetailsItem( TrackDetailsItem(
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
text = status?.let { localize(it) } ?: "", text = status?.let { stringResource(it) } ?: "",
onClick = onStatusClick, onClick = onStatusClick,
) )
VerticalDivider() VerticalDivider()
@ -209,7 +209,7 @@ private fun TrackInfoItem(
modifier = Modifier modifier = Modifier
.weight(1f) .weight(1f)
.alpha(if (score == null) UnsetStatusTextAlpha else 1f), .alpha(if (score == null) UnsetStatusTextAlpha else 1f),
text = score ?: localize(MR.strings.score), text = score ?: stringResource(MR.strings.score),
onClick = onScoreClick, onClick = onScoreClick,
) )
} }
@ -221,14 +221,14 @@ private fun TrackInfoItem(
TrackDetailsItem( TrackDetailsItem(
modifier = Modifier.weight(1F), modifier = Modifier.weight(1F),
text = startDate, text = startDate,
placeholder = localize(MR.strings.track_started_reading_date), placeholder = stringResource(MR.strings.track_started_reading_date),
onClick = onStartDateClick, onClick = onStartDateClick,
) )
VerticalDivider() VerticalDivider()
TrackDetailsItem( TrackDetailsItem(
modifier = Modifier.weight(1F), modifier = Modifier.weight(1F),
text = endDate, text = endDate,
placeholder = localize(MR.strings.track_finished_reading_date), placeholder = stringResource(MR.strings.track_finished_reading_date),
onClick = onEndDateClick, onClick = onEndDateClick,
) )
} }
@ -279,7 +279,7 @@ private fun TrackInfoItemEmpty(
.padding(start = 16.dp) .padding(start = 16.dp)
.weight(1f), .weight(1f),
) { ) {
Text(text = localize(MR.strings.add_tracking)) Text(text = stringResource(MR.strings.add_tracking))
} }
} }
} }
@ -294,7 +294,7 @@ private fun TrackInfoItemMenu(
IconButton(onClick = { expanded = true }) { IconButton(onClick = { expanded = true }) {
Icon( Icon(
imageVector = Icons.Default.MoreVert, imageVector = Icons.Default.MoreVert,
contentDescription = localize(MR.strings.label_more), contentDescription = stringResource(MR.strings.label_more),
) )
} }
DropdownMenu( DropdownMenu(
@ -302,14 +302,14 @@ private fun TrackInfoItemMenu(
onDismissRequest = { expanded = false }, onDismissRequest = { expanded = false },
) { ) {
DropdownMenuItem( DropdownMenuItem(
text = { Text(localize(MR.strings.action_open_in_browser)) }, text = { Text(stringResource(MR.strings.action_open_in_browser)) },
onClick = { onClick = {
onOpenInBrowser() onOpenInBrowser()
expanded = false expanded = false
}, },
) )
DropdownMenuItem( DropdownMenuItem(
text = { Text(localize(MR.strings.action_remove)) }, text = { Text(stringResource(MR.strings.action_remove)) },
onClick = { onClick = {
onRemoved() onRemoved()
expanded = false expanded = false

View File

@ -41,7 +41,7 @@ import tachiyomi.presentation.core.components.WheelNumberPicker
import tachiyomi.presentation.core.components.WheelTextPicker import tachiyomi.presentation.core.components.WheelTextPicker
import tachiyomi.presentation.core.components.material.AlertDialogContent import tachiyomi.presentation.core.components.material.AlertDialogContent
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.isScrolledToEnd import tachiyomi.presentation.core.util.isScrolledToEnd
import tachiyomi.presentation.core.util.isScrolledToStart import tachiyomi.presentation.core.util.isScrolledToStart
@ -54,7 +54,7 @@ fun TrackStatusSelector(
onDismissRequest: () -> Unit, onDismissRequest: () -> Unit,
) { ) {
BaseSelector( BaseSelector(
title = localize(MR.strings.status), title = stringResource(MR.strings.status),
content = { content = {
val state = rememberLazyListState() val state = rememberLazyListState()
ScrollbarLazyColumn(state = state) { ScrollbarLazyColumn(state = state) {
@ -77,7 +77,7 @@ fun TrackStatusSelector(
onClick = null, onClick = null,
) )
Text( Text(
text = value?.let { localize(it) } ?: "", text = value?.let { stringResource(it) } ?: "",
style = MaterialTheme.typography.bodyLarge.merge(), style = MaterialTheme.typography.bodyLarge.merge(),
modifier = Modifier.padding(start = 24.dp), modifier = Modifier.padding(start = 24.dp),
) )
@ -102,7 +102,7 @@ fun TrackChapterSelector(
onDismissRequest: () -> Unit, onDismissRequest: () -> Unit,
) { ) {
BaseSelector( BaseSelector(
title = localize(MR.strings.chapters), title = stringResource(MR.strings.chapters),
content = { content = {
WheelNumberPicker( WheelNumberPicker(
items = range.toImmutableList(), items = range.toImmutableList(),
@ -125,7 +125,7 @@ fun TrackScoreSelector(
onDismissRequest: () -> Unit, onDismissRequest: () -> Unit,
) { ) {
BaseSelector( BaseSelector(
title = localize(MR.strings.score), title = stringResource(MR.strings.score),
content = { content = {
WheelTextPicker( WheelTextPicker(
items = selections, items = selections,
@ -172,15 +172,15 @@ fun TrackDateSelector(
) { ) {
if (onRemove != null) { if (onRemove != null) {
TextButton(onClick = onRemove) { TextButton(onClick = onRemove) {
Text(text = localize(MR.strings.action_remove)) Text(text = stringResource(MR.strings.action_remove))
} }
Spacer(modifier = Modifier.weight(1f)) Spacer(modifier = Modifier.weight(1f))
} }
TextButton(onClick = onDismissRequest) { TextButton(onClick = onDismissRequest) {
Text(text = localize(MR.strings.action_cancel)) Text(text = stringResource(MR.strings.action_cancel))
} }
TextButton(onClick = { onConfirm(pickerState.selectedDateMillis!!) }) { TextButton(onClick = { onConfirm(pickerState.selectedDateMillis!!) }) {
Text(text = localize(MR.strings.action_ok)) Text(text = stringResource(MR.strings.action_ok))
} }
} }
} }
@ -215,10 +215,10 @@ private fun BaseSelector(
Spacer(modifier = Modifier.weight(1f)) Spacer(modifier = Modifier.weight(1f))
} }
TextButton(onClick = onDismissRequest) { TextButton(onClick = onDismissRequest) {
Text(text = localize(MR.strings.action_cancel)) Text(text = stringResource(MR.strings.action_cancel))
} }
TextButton(onClick = onConfirm) { TextButton(onClick = onConfirm) {
Text(text = localize(MR.strings.action_ok)) Text(text = stringResource(MR.strings.action_ok))
} }
} }
}, },

View File

@ -65,7 +65,7 @@ import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.ScrollbarLazyColumn import tachiyomi.presentation.core.components.ScrollbarLazyColumn
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.screens.LoadingScreen import tachiyomi.presentation.core.screens.LoadingScreen
import tachiyomi.presentation.core.util.plus import tachiyomi.presentation.core.util.plus
@ -120,7 +120,7 @@ fun TrackerSearch(
decorationBox = { decorationBox = {
if (query.text.isEmpty()) { if (query.text.isEmpty()) {
Text( Text(
text = localize(MR.strings.action_search_hint), text = stringResource(MR.strings.action_search_hint),
color = MaterialTheme.colorScheme.onSurfaceVariant, color = MaterialTheme.colorScheme.onSurfaceVariant,
style = MaterialTheme.typography.bodyLarge, style = MaterialTheme.typography.bodyLarge,
) )
@ -163,7 +163,7 @@ fun TrackerSearch(
.fillMaxWidth(), .fillMaxWidth(),
elevation = ButtonDefaults.elevatedButtonElevation(), elevation = ButtonDefaults.elevatedButtonElevation(),
) { ) {
Text(text = localize(MR.strings.action_track)) Text(text = stringResource(MR.strings.action_track))
} }
} }
}, },
@ -204,7 +204,7 @@ fun TrackerSearch(
EmptyScreen( EmptyScreen(
modifier = Modifier.padding(innerPadding), modifier = Modifier.padding(innerPadding),
message = queryResult.exceptionOrNull()?.message message = queryResult.exceptionOrNull()?.message
?: localize(MR.strings.unknown_error), ?: stringResource(MR.strings.unknown_error),
) )
} }
} }
@ -263,19 +263,19 @@ private fun SearchResultItem(
) )
if (type.isNotBlank()) { if (type.isNotBlank()) {
SearchResultItemDetails( SearchResultItemDetails(
title = localize(MR.strings.track_type), title = stringResource(MR.strings.track_type),
text = type, text = type,
) )
} }
if (startDate.isNotBlank()) { if (startDate.isNotBlank()) {
SearchResultItemDetails( SearchResultItemDetails(
title = localize(MR.strings.label_started), title = stringResource(MR.strings.label_started),
text = startDate, text = startDate,
) )
} }
if (status.isNotBlank()) { if (status.isNotBlank()) {
SearchResultItemDetails( SearchResultItemDetails(
title = localize(MR.strings.track_status), title = stringResource(MR.strings.track_status),
text = status, text = status,
) )
} }

View File

@ -5,7 +5,7 @@ import androidx.compose.material3.Text
import androidx.compose.material3.TextButton import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun UpdatesDeleteConfirmationDialog( fun UpdatesDeleteConfirmationDialog(
@ -14,7 +14,7 @@ fun UpdatesDeleteConfirmationDialog(
) { ) {
AlertDialog( AlertDialog(
text = { text = {
Text(text = localize(MR.strings.confirm_delete_chapters)) Text(text = stringResource(MR.strings.confirm_delete_chapters))
}, },
onDismissRequest = onDismissRequest, onDismissRequest = onDismissRequest,
confirmButton = { confirmButton = {
@ -22,12 +22,12 @@ fun UpdatesDeleteConfirmationDialog(
onConfirm() onConfirm()
onDismissRequest() onDismissRequest()
}) { }) {
Text(text = localize(MR.strings.action_ok)) Text(text = stringResource(MR.strings.action_ok))
} }
}, },
dismissButton = { dismissButton = {
TextButton(onClick = onDismissRequest) { TextButton(onClick = onDismissRequest) {
Text(text = localize(MR.strings.action_cancel)) Text(text = stringResource(MR.strings.action_cancel))
} }
}, },
) )

View File

@ -34,7 +34,7 @@ import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.FastScrollLazyColumn import tachiyomi.presentation.core.components.FastScrollLazyColumn
import tachiyomi.presentation.core.components.material.PullRefresh import tachiyomi.presentation.core.components.material.PullRefresh
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.screens.LoadingScreen import tachiyomi.presentation.core.screens.LoadingScreen
import kotlin.time.Duration.Companion.seconds import kotlin.time.Duration.Companion.seconds
@ -146,12 +146,12 @@ private fun UpdatesAppBar(
) { ) {
AppBar( AppBar(
modifier = modifier, modifier = modifier,
title = localize(MR.strings.label_recent_updates), title = stringResource(MR.strings.label_recent_updates),
actions = { actions = {
AppBarActions( AppBarActions(
persistentListOf( persistentListOf(
AppBar.Action( AppBar.Action(
title = localize(MR.strings.action_update_library), title = stringResource(MR.strings.action_update_library),
icon = Icons.Outlined.Refresh, icon = Icons.Outlined.Refresh,
onClick = onUpdateLibrary, onClick = onUpdateLibrary,
), ),
@ -164,12 +164,12 @@ private fun UpdatesAppBar(
AppBarActions( AppBarActions(
persistentListOf( persistentListOf(
AppBar.Action( AppBar.Action(
title = localize(MR.strings.action_select_all), title = stringResource(MR.strings.action_select_all),
icon = Icons.Outlined.SelectAll, icon = Icons.Outlined.SelectAll,
onClick = onSelectAll, onClick = onSelectAll,
), ),
AppBar.Action( AppBar.Action(
title = localize(MR.strings.action_select_inverse), title = stringResource(MR.strings.action_select_inverse),
icon = Icons.Outlined.FlipToBack, icon = Icons.Outlined.FlipToBack,
onClick = onInvertSelection, onClick = onInvertSelection,
), ),

View File

@ -44,7 +44,7 @@ import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.ListGroupHeader import tachiyomi.presentation.core.components.ListGroupHeader
import tachiyomi.presentation.core.components.material.ReadItemAlpha import tachiyomi.presentation.core.components.material.ReadItemAlpha
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.selectedBackground import tachiyomi.presentation.core.util.selectedBackground
internal fun LazyListScope.updatesLastUpdatedItem( internal fun LazyListScope.updatesLastUpdatedItem(
@ -56,7 +56,7 @@ internal fun LazyListScope.updatesLastUpdatedItem(
.padding(horizontal = MaterialTheme.padding.medium, vertical = MaterialTheme.padding.small), .padding(horizontal = MaterialTheme.padding.medium, vertical = MaterialTheme.padding.small),
) { ) {
Text( Text(
text = localize(MR.strings.updates_last_update_info, relativeTimeSpanString(lastUpdated)), text = stringResource(MR.strings.updates_last_update_info, relativeTimeSpanString(lastUpdated)),
fontStyle = FontStyle.Italic, fontStyle = FontStyle.Italic,
) )
} }
@ -107,7 +107,7 @@ internal fun LazyListScope.updatesUiItems(
)/* SY <-- */ && it > 0L )/* SY <-- */ && it > 0L
} }
?.let { ?.let {
localize( stringResource(
MR.strings.chapter_progress, MR.strings.chapter_progress,
it + 1, it + 1,
) )
@ -190,7 +190,7 @@ private fun UpdatesUiItem(
if (!update.read) { if (!update.read) {
Icon( Icon(
imageVector = Icons.Filled.Circle, imageVector = Icons.Filled.Circle,
contentDescription = localize(MR.strings.unread), contentDescription = stringResource(MR.strings.unread),
modifier = Modifier modifier = Modifier
.height(8.dp) .height(8.dp)
.padding(end = 4.dp), .padding(end = 4.dp),
@ -200,7 +200,7 @@ private fun UpdatesUiItem(
if (update.bookmark) { if (update.bookmark) {
Icon( Icon(
imageVector = Icons.Filled.Bookmark, imageVector = Icons.Filled.Bookmark,
contentDescription = localize(MR.strings.action_filter_bookmarked), contentDescription = stringResource(MR.strings.action_filter_bookmarked),
modifier = Modifier modifier = Modifier
.sizeIn(maxHeight = with(LocalDensity.current) { textHeight.toDp() - 2.dp }), .sizeIn(maxHeight = with(LocalDensity.current) { textHeight.toDp() - 2.dp }),
tint = MaterialTheme.colorScheme.primary, tint = MaterialTheme.colorScheme.primary,

View File

@ -4,7 +4,7 @@ import android.content.Context
import eu.kanade.tachiyomi.network.HttpException import eu.kanade.tachiyomi.network.HttpException
import eu.kanade.tachiyomi.source.online.LicensedMangaChaptersException import eu.kanade.tachiyomi.source.online.LicensedMangaChaptersException
import eu.kanade.tachiyomi.util.system.isOnline import eu.kanade.tachiyomi.util.system.isOnline
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.data.source.NoResultsException import tachiyomi.data.source.NoResultsException
import tachiyomi.domain.source.model.SourceNotInstalledException import tachiyomi.domain.source.model.SourceNotInstalledException
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
@ -14,18 +14,18 @@ context(Context)
val Throwable.formattedMessage: String val Throwable.formattedMessage: String
get() { get() {
when (this) { when (this) {
is HttpException -> return localize(MR.strings.exception_http, code) is HttpException -> return stringResource(MR.strings.exception_http, code)
is UnknownHostException -> { is UnknownHostException -> {
return if (!isOnline()) { return if (!isOnline()) {
localize(MR.strings.exception_offline) stringResource(MR.strings.exception_offline)
} else { } else {
localize(MR.strings.exception_unknown_host, message ?: "") stringResource(MR.strings.exception_unknown_host, message ?: "")
} }
} }
is NoResultsException -> return localize(MR.strings.no_results_found) is NoResultsException -> return stringResource(MR.strings.no_results_found)
is SourceNotInstalledException -> return localize(MR.strings.loader_not_implemented_error) is SourceNotInstalledException -> return stringResource(MR.strings.loader_not_implemented_error)
is LicensedMangaChaptersException -> return localize(MR.strings.licensed_manga_chapters_error) is LicensedMangaChaptersException -> return stringResource(MR.strings.licensed_manga_chapters_error)
} }
return when (val className = this::class.simpleName) { return when (val className = this::class.simpleName) {
"Exception", "IOException" -> message ?: className "Exception", "IOException" -> message ?: className

View File

@ -4,9 +4,9 @@ import android.content.Context
import android.text.format.DateUtils import android.text.format.DateUtils
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.ReadOnlyComposable import androidx.compose.runtime.ReadOnlyComposable
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import java.util.Date import java.util.Date
import kotlin.time.Duration import kotlin.time.Duration
import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.minutes
@ -14,10 +14,14 @@ import kotlin.time.Duration.Companion.minutes
fun Duration.toDurationString(context: Context, fallback: String): String { fun Duration.toDurationString(context: Context, fallback: String): String {
return toComponents { days, hours, minutes, seconds, _ -> return toComponents { days, hours, minutes, seconds, _ ->
buildList(4) { buildList(4) {
if (days != 0L) add(context.localize(MR.strings.day_short, days)) if (days != 0L) add(context.stringResource(MR.strings.day_short, days))
if (hours != 0) add(context.localize(MR.strings.hour_short, hours)) if (hours != 0) add(context.stringResource(MR.strings.hour_short, hours))
if (minutes != 0 && (days == 0L || hours == 0)) add(context.localize(MR.strings.minute_short, minutes)) if (minutes != 0 && (days == 0L || hours == 0)) {
if (seconds != 0 && days == 0L && hours == 0) add(context.localize(MR.strings.seconds_short, seconds)) add(
context.stringResource(MR.strings.minute_short, minutes),
)
}
if (seconds != 0 && days == 0L && hours == 0) add(context.stringResource(MR.strings.seconds_short, seconds))
}.joinToString(" ").ifBlank { fallback } }.joinToString(" ").ifBlank { fallback }
} }
} }
@ -27,8 +31,10 @@ fun Duration.toDurationString(context: Context, fallback: String): String {
fun relativeTimeSpanString(epochMillis: Long): String { fun relativeTimeSpanString(epochMillis: Long): String {
val now = Date().time val now = Date().time
return when { return when {
epochMillis <= 0L -> localize(MR.strings.relative_time_span_never) epochMillis <= 0L -> stringResource(MR.strings.relative_time_span_never)
now - epochMillis < 1.minutes.inWholeMilliseconds -> localize(MR.strings.updates_last_update_info_just_now) now - epochMillis < 1.minutes.inWholeMilliseconds -> stringResource(
MR.strings.updates_last_update_info_just_now,
)
else -> DateUtils.getRelativeTimeSpanString(epochMillis, now, DateUtils.MINUTE_IN_MILLIS).toString() else -> DateUtils.getRelativeTimeSpanString(epochMillis, now, DateUtils.MINUTE_IN_MILLIS).toString()
} }
} }

View File

@ -43,7 +43,7 @@ import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun WebViewScreenContent( fun WebViewScreenContent(
@ -125,7 +125,7 @@ fun WebViewScreenContent(
AppBarActions( AppBarActions(
persistentListOf( persistentListOf(
AppBar.Action( AppBar.Action(
title = localize(MR.strings.action_webview_back), title = stringResource(MR.strings.action_webview_back),
icon = Icons.AutoMirrored.Outlined.ArrowBack, icon = Icons.AutoMirrored.Outlined.ArrowBack,
onClick = { onClick = {
if (navigator.canGoBack) { if (navigator.canGoBack) {
@ -135,7 +135,7 @@ fun WebViewScreenContent(
enabled = navigator.canGoBack, enabled = navigator.canGoBack,
), ),
AppBar.Action( AppBar.Action(
title = localize(MR.strings.action_webview_forward), title = stringResource(MR.strings.action_webview_forward),
icon = Icons.AutoMirrored.Outlined.ArrowForward, icon = Icons.AutoMirrored.Outlined.ArrowForward,
onClick = { onClick = {
if (navigator.canGoForward) { if (navigator.canGoForward) {
@ -145,19 +145,19 @@ fun WebViewScreenContent(
enabled = navigator.canGoForward, enabled = navigator.canGoForward,
), ),
AppBar.OverflowAction( AppBar.OverflowAction(
title = localize(MR.strings.action_webview_refresh), title = stringResource(MR.strings.action_webview_refresh),
onClick = { navigator.reload() }, onClick = { navigator.reload() },
), ),
AppBar.OverflowAction( AppBar.OverflowAction(
title = localize(MR.strings.action_share), title = stringResource(MR.strings.action_share),
onClick = { onShare(currentUrl) }, onClick = { onShare(currentUrl) },
), ),
AppBar.OverflowAction( AppBar.OverflowAction(
title = localize(MR.strings.action_open_in_browser), title = stringResource(MR.strings.action_open_in_browser),
onClick = { onOpenInBrowser(currentUrl) }, onClick = { onOpenInBrowser(currentUrl) },
), ),
AppBar.OverflowAction( AppBar.OverflowAction(
title = localize(MR.strings.pref_clear_cookies), title = stringResource(MR.strings.pref_clear_cookies),
onClick = { onClearCookies(currentUrl) }, onClick = { onClearCookies(currentUrl) },
), ),
), ),

View File

@ -68,7 +68,7 @@ import kotlinx.coroutines.flow.onEach
import logcat.LogPriority import logcat.LogPriority
import logcat.LogcatLogger import logcat.LogcatLogger
import org.conscrypt.Conscrypt import org.conscrypt.Conscrypt
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.system.logcat import tachiyomi.core.util.system.logcat
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.widget.WidgetManager import tachiyomi.presentation.widget.WidgetManager
@ -129,8 +129,8 @@ class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
Notifications.ID_INCOGNITO_MODE, Notifications.ID_INCOGNITO_MODE,
Notifications.CHANNEL_INCOGNITO_MODE, Notifications.CHANNEL_INCOGNITO_MODE,
) { ) {
setContentTitle(localize(MR.strings.pref_incognito_mode)) setContentTitle(stringResource(MR.strings.pref_incognito_mode))
setContentText(localize(MR.strings.notification_incognito_text)) setContentText(stringResource(MR.strings.notification_incognito_text))
setSmallIcon(R.drawable.ic_glasses_24dp) setSmallIcon(R.drawable.ic_glasses_24dp)
setOngoing(true) setOngoing(true)

View File

@ -46,7 +46,7 @@ import logcat.LogPriority
import okio.buffer import okio.buffer
import okio.gzip import okio.gzip
import okio.sink import okio.sink
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.core.preference.Preference import tachiyomi.core.preference.Preference
import tachiyomi.core.preference.PreferenceStore import tachiyomi.core.preference.PreferenceStore
import tachiyomi.core.util.system.logcat import tachiyomi.core.util.system.logcat
@ -95,7 +95,7 @@ class BackupCreator(
*/ */
suspend fun createBackup(uri: Uri, flags: Int, isAutoBackup: Boolean): String { suspend fun createBackup(uri: Uri, flags: Int, isAutoBackup: Boolean): String {
if (!context.hasPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)) { if (!context.hasPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
throw IllegalStateException(context.localize(MR.strings.missing_storage_permission)) throw IllegalStateException(context.stringResource(MR.strings.missing_storage_permission))
} }
val databaseManga = getFavorites.await() /* SY --> */ + val databaseManga = getFavorites.await() /* SY --> */ +
@ -138,7 +138,7 @@ class BackupCreator(
UniFile.fromUri(context, uri) UniFile.fromUri(context, uri)
} }
) )
?: throw Exception(context.localize(MR.strings.create_backup_file_error)) ?: throw Exception(context.stringResource(MR.strings.create_backup_file_error))
if (!file.isFile) { if (!file.isFile) {
throw IllegalStateException("Failed to get handle on a backup file") throw IllegalStateException("Failed to get handle on a backup file")
@ -146,7 +146,7 @@ class BackupCreator(
val byteArray = parser.encodeToByteArray(BackupSerializer, backup) val byteArray = parser.encodeToByteArray(BackupSerializer, backup)
if (byteArray.isEmpty()) { if (byteArray.isEmpty()) {
throw IllegalStateException(context.localize(MR.strings.empty_backup_error)) throw IllegalStateException(context.stringResource(MR.strings.empty_backup_error))
} }
file.openOutputStream().also { file.openOutputStream().also {

View File

@ -4,7 +4,7 @@ import android.content.Context
import android.net.Uri import android.net.Uri
import eu.kanade.tachiyomi.data.track.TrackerManager import eu.kanade.tachiyomi.data.track.TrackerManager
import eu.kanade.tachiyomi.util.BackupUtil import eu.kanade.tachiyomi.util.BackupUtil
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.domain.source.service.SourceManager import tachiyomi.domain.source.service.SourceManager
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
@ -29,7 +29,7 @@ class BackupFileValidator(
} }
if (backup.backupManga.isEmpty()) { if (backup.backupManga.isEmpty()) {
throw IllegalStateException(context.localize(MR.strings.invalid_backup_file_missing_manga)) throw IllegalStateException(context.stringResource(MR.strings.invalid_backup_file_missing_manga))
} }
val sources = backup.backupSources.associate { it.sourceId to it.name } val sources = backup.backupSources.associate { it.sourceId to it.name }

View File

@ -12,8 +12,8 @@ import eu.kanade.tachiyomi.util.storage.getUriCompat
import eu.kanade.tachiyomi.util.system.cancelNotification import eu.kanade.tachiyomi.util.system.cancelNotification
import eu.kanade.tachiyomi.util.system.notificationBuilder import eu.kanade.tachiyomi.util.system.notificationBuilder
import eu.kanade.tachiyomi.util.system.notify import eu.kanade.tachiyomi.util.system.notify
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.pluralStringResource
import tachiyomi.core.i18n.localizePlural import tachiyomi.core.i18n.stringResource
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.io.File import java.io.File
@ -47,7 +47,7 @@ class BackupNotifier(private val context: Context) {
fun showBackupProgress(): NotificationCompat.Builder { fun showBackupProgress(): NotificationCompat.Builder {
val builder = with(progressNotificationBuilder) { val builder = with(progressNotificationBuilder) {
setContentTitle(context.localize(MR.strings.creating_backup)) setContentTitle(context.stringResource(MR.strings.creating_backup))
setProgress(0, 0, true) setProgress(0, 0, true)
} }
@ -61,7 +61,7 @@ class BackupNotifier(private val context: Context) {
context.cancelNotification(Notifications.ID_BACKUP_PROGRESS) context.cancelNotification(Notifications.ID_BACKUP_PROGRESS)
with(completeNotificationBuilder) { with(completeNotificationBuilder) {
setContentTitle(context.localize(MR.strings.creating_backup_error)) setContentTitle(context.stringResource(MR.strings.creating_backup_error))
setContentText(error) setContentText(error)
show(Notifications.ID_BACKUP_COMPLETE) show(Notifications.ID_BACKUP_COMPLETE)
@ -72,13 +72,13 @@ class BackupNotifier(private val context: Context) {
context.cancelNotification(Notifications.ID_BACKUP_PROGRESS) context.cancelNotification(Notifications.ID_BACKUP_PROGRESS)
with(completeNotificationBuilder) { with(completeNotificationBuilder) {
setContentTitle(context.localize(MR.strings.backup_created)) setContentTitle(context.stringResource(MR.strings.backup_created))
setContentText(unifile.filePath ?: unifile.name) setContentText(unifile.filePath ?: unifile.name)
clearActions() clearActions()
addAction( addAction(
R.drawable.ic_share_24dp, R.drawable.ic_share_24dp,
context.localize(MR.strings.action_share), context.stringResource(MR.strings.action_share),
NotificationReceiver.shareBackupPendingBroadcast( NotificationReceiver.shareBackupPendingBroadcast(
context, context,
unifile.uri, unifile.uri,
@ -92,7 +92,7 @@ class BackupNotifier(private val context: Context) {
fun showRestoreProgress( fun showRestoreProgress(
content: String = "", content: String = "",
contentTitle: String = context.localize( contentTitle: String = context.stringResource(
MR.strings.restoring_backup, MR.strings.restoring_backup,
), ),
progress: Int = 0, progress: Int = 0,
@ -111,7 +111,7 @@ class BackupNotifier(private val context: Context) {
clearActions() clearActions()
addAction( addAction(
R.drawable.ic_close_24dp, R.drawable.ic_close_24dp,
context.localize(MR.strings.action_cancel), context.stringResource(MR.strings.action_cancel),
NotificationReceiver.cancelRestorePendingBroadcast(context, Notifications.ID_RESTORE_PROGRESS), NotificationReceiver.cancelRestorePendingBroadcast(context, Notifications.ID_RESTORE_PROGRESS),
) )
} }
@ -125,7 +125,7 @@ class BackupNotifier(private val context: Context) {
context.cancelNotification(Notifications.ID_RESTORE_PROGRESS) context.cancelNotification(Notifications.ID_RESTORE_PROGRESS)
with(completeNotificationBuilder) { with(completeNotificationBuilder) {
setContentTitle(context.localize(MR.strings.restoring_backup_error)) setContentTitle(context.stringResource(MR.strings.restoring_backup_error))
setContentText(error) setContentText(error)
show(Notifications.ID_RESTORE_COMPLETE) show(Notifications.ID_RESTORE_COMPLETE)
@ -137,13 +137,13 @@ class BackupNotifier(private val context: Context) {
errorCount: Int, errorCount: Int,
path: String?, path: String?,
file: String?, file: String?,
contentTitle: String = context.localize( contentTitle: String = context.stringResource(
MR.strings.restore_completed, MR.strings.restore_completed,
), ),
) { ) {
context.cancelNotification(Notifications.ID_RESTORE_PROGRESS) context.cancelNotification(Notifications.ID_RESTORE_PROGRESS)
val timeString = context.localize( val timeString = context.stringResource(
MR.strings.restore_duration, MR.strings.restore_duration,
TimeUnit.MILLISECONDS.toMinutes(time), TimeUnit.MILLISECONDS.toMinutes(time),
TimeUnit.MILLISECONDS.toSeconds(time) - TimeUnit.MINUTES.toSeconds( TimeUnit.MILLISECONDS.toSeconds(time) - TimeUnit.MINUTES.toSeconds(
@ -154,7 +154,7 @@ class BackupNotifier(private val context: Context) {
with(completeNotificationBuilder) { with(completeNotificationBuilder) {
setContentTitle(contentTitle) setContentTitle(contentTitle)
setContentText( setContentText(
context.localizePlural( context.pluralStringResource(
MR.plurals.restore_completed_message, MR.plurals.restore_completed_message,
errorCount, errorCount,
timeString, timeString,
@ -171,7 +171,7 @@ class BackupNotifier(private val context: Context) {
setContentIntent(errorLogIntent) setContentIntent(errorLogIntent)
addAction( addAction(
R.drawable.ic_folder_24dp, R.drawable.ic_folder_24dp,
context.localize(MR.strings.action_show_errors), context.stringResource(MR.strings.action_show_errors),
errorLogIntent, errorLogIntent,
) )
} }

View File

@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.util.system.isRunning
import eu.kanade.tachiyomi.util.system.workManager import eu.kanade.tachiyomi.util.system.workManager
import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CancellationException
import logcat.LogPriority import logcat.LogPriority
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.system.logcat import tachiyomi.core.util.system.logcat
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
@ -41,7 +41,7 @@ class BackupRestoreJob(private val context: Context, workerParams: WorkerParamet
Result.success() Result.success()
} catch (e: Exception) { } catch (e: Exception) {
if (e is CancellationException) { if (e is CancellationException) {
notifier.showRestoreError(context.localize(MR.strings.restoring_backup_canceled)) notifier.showRestoreError(context.stringResource(MR.strings.restoring_backup_canceled))
Result.success() Result.success()
} else { } else {
logcat(LogPriority.ERROR, e) logcat(LogPriority.ERROR, e)

View File

@ -28,7 +28,7 @@ import exh.source.MERGED_SOURCE_ID
import exh.util.nullIfBlank import exh.util.nullIfBlank
import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.isActive import kotlinx.coroutines.isActive
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.core.preference.AndroidPreferenceStore import tachiyomi.core.preference.AndroidPreferenceStore
import tachiyomi.core.preference.PreferenceStore import tachiyomi.core.preference.PreferenceStore
import tachiyomi.data.DatabaseHandler import tachiyomi.data.DatabaseHandler
@ -112,7 +112,7 @@ class BackupRestorer(
errors.size, errors.size,
logFile.parent, logFile.parent,
logFile.name, logFile.name,
contentTitle = context.localize(MR.strings.library_sync_complete), contentTitle = context.stringResource(MR.strings.library_sync_complete),
) )
} else { } else {
notifier.showRestoreComplete(time, errors.size, logFile.parent, logFile.name) notifier.showRestoreComplete(time, errors.size, logFile.parent, logFile.name)
@ -218,8 +218,8 @@ class BackupRestorer(
showRestoreProgress( showRestoreProgress(
restoreProgress, restoreProgress,
restoreAmount, restoreAmount,
context.localize(MR.strings.categories), context.stringResource(MR.strings.categories),
context.localize(MR.strings.restoring_backup), context.stringResource(MR.strings.restoring_backup),
) )
} }
@ -314,14 +314,14 @@ class BackupRestorer(
restoreProgress, restoreProgress,
restoreAmount, restoreAmount,
manga.title, manga.title,
context.localize(MR.strings.syncing_library), context.stringResource(MR.strings.syncing_library),
) )
} else { } else {
showRestoreProgress( showRestoreProgress(
restoreProgress, restoreProgress,
restoreAmount, restoreAmount,
manga.title, manga.title,
context.localize(MR.strings.restoring_backup), context.stringResource(MR.strings.restoring_backup),
) )
} }
} }
@ -822,8 +822,8 @@ class BackupRestorer(
showRestoreProgress( showRestoreProgress(
restoreProgress, restoreProgress,
restoreAmount, restoreAmount,
context.localize(MR.strings.app_settings), context.stringResource(MR.strings.app_settings),
context.localize(MR.strings.restoring_backup), context.stringResource(MR.strings.restoring_backup),
) )
} }
@ -837,8 +837,8 @@ class BackupRestorer(
showRestoreProgress( showRestoreProgress(
restoreProgress, restoreProgress,
restoreAmount, restoreAmount,
context.localize(MR.strings.source_settings), context.stringResource(MR.strings.source_settings),
context.localize(MR.strings.restoring_backup), context.stringResource(MR.strings.restoring_backup),
) )
} }

View File

@ -14,7 +14,7 @@ import eu.kanade.tachiyomi.util.lang.chop
import eu.kanade.tachiyomi.util.system.cancelNotification import eu.kanade.tachiyomi.util.system.cancelNotification
import eu.kanade.tachiyomi.util.system.notificationBuilder import eu.kanade.tachiyomi.util.system.notificationBuilder
import eu.kanade.tachiyomi.util.system.notify import eu.kanade.tachiyomi.util.system.notify
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.util.regex.Pattern import java.util.regex.Pattern
@ -80,12 +80,12 @@ internal class DownloadNotifier(private val context: Context) {
// Pause action // Pause action
addAction( addAction(
R.drawable.ic_pause_24dp, R.drawable.ic_pause_24dp,
context.localize(MR.strings.action_pause), context.stringResource(MR.strings.action_pause),
NotificationReceiver.pauseDownloadsPendingBroadcast(context), NotificationReceiver.pauseDownloadsPendingBroadcast(context),
) )
} }
val downloadingProgressText = context.localize( val downloadingProgressText = context.stringResource(
MR.strings.chapter_downloading_progress, MR.strings.chapter_downloading_progress,
download.downloadedImages, download.downloadedImages,
download.pages!!.size, download.pages!!.size,
@ -117,8 +117,8 @@ internal class DownloadNotifier(private val context: Context) {
*/ */
fun onPaused() { fun onPaused() {
with(progressNotificationBuilder) { with(progressNotificationBuilder) {
setContentTitle(context.localize(MR.strings.chapter_paused)) setContentTitle(context.stringResource(MR.strings.chapter_paused))
setContentText(context.localize(MR.strings.download_notifier_download_paused)) setContentText(context.stringResource(MR.strings.download_notifier_download_paused))
setSmallIcon(R.drawable.ic_pause_24dp) setSmallIcon(R.drawable.ic_pause_24dp)
setProgress(0, 0, false) setProgress(0, 0, false)
setOngoing(false) setOngoing(false)
@ -128,13 +128,13 @@ internal class DownloadNotifier(private val context: Context) {
// Resume action // Resume action
addAction( addAction(
R.drawable.ic_play_arrow_24dp, R.drawable.ic_play_arrow_24dp,
context.localize(MR.strings.action_resume), context.stringResource(MR.strings.action_resume),
NotificationReceiver.resumeDownloadsPendingBroadcast(context), NotificationReceiver.resumeDownloadsPendingBroadcast(context),
) )
// Clear action // Clear action
addAction( addAction(
R.drawable.ic_close_24dp, R.drawable.ic_close_24dp,
context.localize(MR.strings.action_cancel_all), context.stringResource(MR.strings.action_cancel_all),
NotificationReceiver.clearDownloadsPendingBroadcast(context), NotificationReceiver.clearDownloadsPendingBroadcast(context),
) )
@ -164,7 +164,7 @@ internal class DownloadNotifier(private val context: Context) {
*/ */
fun onWarning(reason: String, timeout: Long? = null, contentIntent: PendingIntent? = null) { fun onWarning(reason: String, timeout: Long? = null, contentIntent: PendingIntent? = null) {
with(errorNotificationBuilder) { with(errorNotificationBuilder) {
setContentTitle(context.localize(MR.strings.download_notifier_downloader_title)) setContentTitle(context.stringResource(MR.strings.download_notifier_downloader_title))
setStyle(NotificationCompat.BigTextStyle().bigText(reason)) setStyle(NotificationCompat.BigTextStyle().bigText(reason))
setSmallIcon(R.drawable.ic_warning_white_24dp) setSmallIcon(R.drawable.ic_warning_white_24dp)
setAutoCancel(true) setAutoCancel(true)
@ -192,9 +192,9 @@ internal class DownloadNotifier(private val context: Context) {
// Create notification // Create notification
with(errorNotificationBuilder) { with(errorNotificationBuilder) {
setContentTitle( setContentTitle(
mangaTitle?.plus(": $chapter") ?: context.localize(MR.strings.download_notifier_downloader_title), mangaTitle?.plus(": $chapter") ?: context.stringResource(MR.strings.download_notifier_downloader_title),
) )
setContentText(error ?: context.localize(MR.strings.download_notifier_unknown_error)) setContentText(error ?: context.stringResource(MR.strings.download_notifier_unknown_error))
setSmallIcon(R.drawable.ic_warning_white_24dp) setSmallIcon(R.drawable.ic_warning_white_24dp)
clearActions() clearActions()
setContentIntent(NotificationHandler.openDownloadManagerPendingActivity(context)) setContentIntent(NotificationHandler.openDownloadManagerPendingActivity(context))

View File

@ -9,7 +9,7 @@ import kotlinx.coroutines.MainScope
import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
import logcat.LogPriority import logcat.LogPriority
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.system.logcat import tachiyomi.core.util.system.logcat
import tachiyomi.domain.chapter.model.Chapter import tachiyomi.domain.chapter.model.Chapter
import tachiyomi.domain.download.service.DownloadPreferences import tachiyomi.domain.download.service.DownloadPreferences
@ -59,7 +59,7 @@ class DownloadProvider(
.createDirectory(getMangaDirName(mangaTitle)) .createDirectory(getMangaDirName(mangaTitle))
} catch (e: Throwable) { } catch (e: Throwable) {
logcat(LogPriority.ERROR, e) { "Invalid download directory" } logcat(LogPriority.ERROR, e) { "Invalid download directory" }
throw Exception(context.localize(MR.strings.invalid_location, downloadsDir)) throw Exception(context.stringResource(MR.strings.invalid_location, downloadsDir))
} }
} }

View File

@ -26,7 +26,7 @@ import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
import logcat.LogPriority import logcat.LogPriority
import ru.beryukhov.reactivenetwork.ReactiveNetwork import ru.beryukhov.reactivenetwork.ReactiveNetwork
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.lang.withUIContext import tachiyomi.core.util.lang.withUIContext
import tachiyomi.core.util.system.logcat import tachiyomi.core.util.system.logcat
import tachiyomi.domain.download.service.DownloadPreferences import tachiyomi.domain.download.service.DownloadPreferences
@ -113,7 +113,7 @@ class DownloadService : Service() {
} }
private fun downloaderStop(string: StringResource) { private fun downloaderStop(string: StringResource) {
downloadManager.downloaderStop(localize(string)) downloadManager.downloaderStop(stringResource(string))
} }
private fun listenNetworkChanges() { private fun listenNetworkChanges() {
@ -145,7 +145,7 @@ class DownloadService : Service() {
private fun getPlaceholderNotification(): Notification { private fun getPlaceholderNotification(): Notification {
return notificationBuilder(Notifications.CHANNEL_DOWNLOADER_PROGRESS) { return notificationBuilder(Notifications.CHANNEL_DOWNLOADER_PROGRESS) {
setContentTitle(localize(MR.strings.download_notifier_downloader_title)) setContentTitle(stringResource(MR.strings.download_notifier_downloader_title))
}.build() }.build()
} }
} }

View File

@ -7,7 +7,7 @@ import androidx.core.app.NotificationManagerCompat.IMPORTANCE_HIGH
import androidx.core.app.NotificationManagerCompat.IMPORTANCE_LOW import androidx.core.app.NotificationManagerCompat.IMPORTANCE_LOW
import eu.kanade.tachiyomi.util.system.buildNotificationChannel import eu.kanade.tachiyomi.util.system.buildNotificationChannel
import eu.kanade.tachiyomi.util.system.buildNotificationChannelGroup import eu.kanade.tachiyomi.util.system.buildNotificationChannelGroup
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
/** /**
@ -103,16 +103,16 @@ object Notifications {
notificationManager.createNotificationChannelGroupsCompat( notificationManager.createNotificationChannelGroupsCompat(
listOf( listOf(
buildNotificationChannelGroup(GROUP_BACKUP_RESTORE) { buildNotificationChannelGroup(GROUP_BACKUP_RESTORE) {
setName(context.localize(MR.strings.label_backup)) setName(context.stringResource(MR.strings.label_backup))
}, },
buildNotificationChannelGroup(GROUP_DOWNLOADER) { buildNotificationChannelGroup(GROUP_DOWNLOADER) {
setName(context.localize(MR.strings.download_notifier_downloader_title)) setName(context.stringResource(MR.strings.download_notifier_downloader_title))
}, },
buildNotificationChannelGroup(GROUP_LIBRARY) { buildNotificationChannelGroup(GROUP_LIBRARY) {
setName(context.localize(MR.strings.label_library)) setName(context.stringResource(MR.strings.label_library))
}, },
buildNotificationChannelGroup(GROUP_APK_UPDATES) { buildNotificationChannelGroup(GROUP_APK_UPDATES) {
setName(context.localize(MR.strings.label_recent_updates)) setName(context.stringResource(MR.strings.label_recent_updates))
}, },
), ),
) )
@ -120,57 +120,57 @@ object Notifications {
notificationManager.createNotificationChannelsCompat( notificationManager.createNotificationChannelsCompat(
listOf( listOf(
buildNotificationChannel(CHANNEL_COMMON, IMPORTANCE_LOW) { buildNotificationChannel(CHANNEL_COMMON, IMPORTANCE_LOW) {
setName(context.localize(MR.strings.channel_common)) setName(context.stringResource(MR.strings.channel_common))
}, },
buildNotificationChannel(CHANNEL_LIBRARY_PROGRESS, IMPORTANCE_LOW) { buildNotificationChannel(CHANNEL_LIBRARY_PROGRESS, IMPORTANCE_LOW) {
setName(context.localize(MR.strings.channel_progress)) setName(context.stringResource(MR.strings.channel_progress))
setGroup(GROUP_LIBRARY) setGroup(GROUP_LIBRARY)
setShowBadge(false) setShowBadge(false)
}, },
buildNotificationChannel(CHANNEL_LIBRARY_ERROR, IMPORTANCE_LOW) { buildNotificationChannel(CHANNEL_LIBRARY_ERROR, IMPORTANCE_LOW) {
setName(context.localize(MR.strings.channel_errors)) setName(context.stringResource(MR.strings.channel_errors))
setGroup(GROUP_LIBRARY) setGroup(GROUP_LIBRARY)
setShowBadge(false) setShowBadge(false)
}, },
buildNotificationChannel(CHANNEL_LIBRARY_SKIPPED, IMPORTANCE_LOW) { buildNotificationChannel(CHANNEL_LIBRARY_SKIPPED, IMPORTANCE_LOW) {
setName(context.localize(MR.strings.channel_skipped)) setName(context.stringResource(MR.strings.channel_skipped))
setGroup(GROUP_LIBRARY) setGroup(GROUP_LIBRARY)
setShowBadge(false) setShowBadge(false)
}, },
buildNotificationChannel(CHANNEL_NEW_CHAPTERS, IMPORTANCE_DEFAULT) { buildNotificationChannel(CHANNEL_NEW_CHAPTERS, IMPORTANCE_DEFAULT) {
setName(context.localize(MR.strings.channel_new_chapters)) setName(context.stringResource(MR.strings.channel_new_chapters))
}, },
buildNotificationChannel(CHANNEL_DOWNLOADER_PROGRESS, IMPORTANCE_LOW) { buildNotificationChannel(CHANNEL_DOWNLOADER_PROGRESS, IMPORTANCE_LOW) {
setName(context.localize(MR.strings.channel_progress)) setName(context.stringResource(MR.strings.channel_progress))
setGroup(GROUP_DOWNLOADER) setGroup(GROUP_DOWNLOADER)
setShowBadge(false) setShowBadge(false)
}, },
buildNotificationChannel(CHANNEL_DOWNLOADER_ERROR, IMPORTANCE_LOW) { buildNotificationChannel(CHANNEL_DOWNLOADER_ERROR, IMPORTANCE_LOW) {
setName(context.localize(MR.strings.channel_errors)) setName(context.stringResource(MR.strings.channel_errors))
setGroup(GROUP_DOWNLOADER) setGroup(GROUP_DOWNLOADER)
setShowBadge(false) setShowBadge(false)
}, },
buildNotificationChannel(CHANNEL_BACKUP_RESTORE_PROGRESS, IMPORTANCE_LOW) { buildNotificationChannel(CHANNEL_BACKUP_RESTORE_PROGRESS, IMPORTANCE_LOW) {
setName(context.localize(MR.strings.channel_progress)) setName(context.stringResource(MR.strings.channel_progress))
setGroup(GROUP_BACKUP_RESTORE) setGroup(GROUP_BACKUP_RESTORE)
setShowBadge(false) setShowBadge(false)
}, },
buildNotificationChannel(CHANNEL_BACKUP_RESTORE_COMPLETE, IMPORTANCE_HIGH) { buildNotificationChannel(CHANNEL_BACKUP_RESTORE_COMPLETE, IMPORTANCE_HIGH) {
setName(context.localize(MR.strings.channel_complete)) setName(context.stringResource(MR.strings.channel_complete))
setGroup(GROUP_BACKUP_RESTORE) setGroup(GROUP_BACKUP_RESTORE)
setShowBadge(false) setShowBadge(false)
setSound(null, null) setSound(null, null)
}, },
buildNotificationChannel(CHANNEL_INCOGNITO_MODE, IMPORTANCE_LOW) { buildNotificationChannel(CHANNEL_INCOGNITO_MODE, IMPORTANCE_LOW) {
setName(context.localize(MR.strings.pref_incognito_mode)) setName(context.stringResource(MR.strings.pref_incognito_mode))
}, },
buildNotificationChannel(CHANNEL_APP_UPDATE, IMPORTANCE_DEFAULT) { buildNotificationChannel(CHANNEL_APP_UPDATE, IMPORTANCE_DEFAULT) {
setGroup(GROUP_APK_UPDATES) setGroup(GROUP_APK_UPDATES)
setName(context.localize(MR.strings.channel_app_updates)) setName(context.stringResource(MR.strings.channel_app_updates))
}, },
buildNotificationChannel(CHANNEL_EXTENSIONS_UPDATE, IMPORTANCE_DEFAULT) { buildNotificationChannel(CHANNEL_EXTENSIONS_UPDATE, IMPORTANCE_DEFAULT) {
setGroup(GROUP_APK_UPDATES) setGroup(GROUP_APK_UPDATES)
setName(context.localize(MR.strings.channel_ext_updates)) setName(context.stringResource(MR.strings.channel_ext_updates))
}, },
), ),
) )

View File

@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.util.storage.cacheImageDir
import eu.kanade.tachiyomi.util.storage.getUriCompat import eu.kanade.tachiyomi.util.storage.getUriCompat
import logcat.LogPriority import logcat.LogPriority
import okio.IOException import okio.IOException
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.system.ImageUtil import tachiyomi.core.util.system.ImageUtil
import tachiyomi.core.util.system.logcat import tachiyomi.core.util.system.logcat
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
@ -71,7 +71,7 @@ class ImageSaver(
val imageLocation = (image.location as Location.Pictures).relativePath val imageLocation = (image.location as Location.Pictures).relativePath
val relativePath = listOf( val relativePath = listOf(
Environment.DIRECTORY_PICTURES, Environment.DIRECTORY_PICTURES,
context.localize(MR.strings.app_name), context.stringResource(MR.strings.app_name),
imageLocation, imageLocation,
).joinToString(File.separator) ).joinToString(File.separator)
@ -86,7 +86,7 @@ class ImageSaver(
context.contentResolver.insert( context.contentResolver.insert(
pictureDir, pictureDir,
contentValues, contentValues,
) ?: throw IOException(context.localize(MR.strings.error_saving_picture)) ) ?: throw IOException(context.stringResource(MR.strings.error_saving_picture))
} }
try { try {
@ -97,7 +97,7 @@ class ImageSaver(
} }
} catch (e: Exception) { } catch (e: Exception) {
logcat(LogPriority.ERROR, e) logcat(LogPriority.ERROR, e)
throw IOException(context.localize(MR.strings.error_saving_picture)) throw IOException(context.stringResource(MR.strings.error_saving_picture))
} }
DiskUtil.scanMedia(context, picture) DiskUtil.scanMedia(context, picture)
@ -185,7 +185,7 @@ sealed interface Location {
is Pictures -> { is Pictures -> {
val file = File( val file = File(
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
context.localize(MR.strings.app_name), context.stringResource(MR.strings.app_name),
) )
if (relativePath.isNotEmpty()) { if (relativePath.isNotEmpty()) {
return File( return File(

View File

@ -21,7 +21,7 @@ import eu.kanade.tachiyomi.util.system.workManager
import logcat.LogPriority import logcat.LogPriority
import okhttp3.internal.http2.ErrorCode import okhttp3.internal.http2.ErrorCode
import okhttp3.internal.http2.StreamResetException import okhttp3.internal.http2.StreamResetException
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.lang.withIOContext import tachiyomi.core.util.lang.withIOContext
import tachiyomi.core.util.system.logcat import tachiyomi.core.util.system.logcat
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
@ -37,7 +37,7 @@ class AppUpdateDownloadJob(private val context: Context, workerParams: WorkerPar
override suspend fun doWork(): Result { override suspend fun doWork(): Result {
val url = inputData.getString(EXTRA_DOWNLOAD_URL) val url = inputData.getString(EXTRA_DOWNLOAD_URL)
val title = inputData.getString(EXTRA_DOWNLOAD_TITLE) ?: context.localize(MR.strings.app_name) val title = inputData.getString(EXTRA_DOWNLOAD_TITLE) ?: context.stringResource(MR.strings.app_name)
if (url.isNullOrEmpty()) { if (url.isNullOrEmpty()) {
return Result.failure() return Result.failure()

View File

@ -13,7 +13,7 @@ import eu.kanade.tachiyomi.data.notification.NotificationReceiver
import eu.kanade.tachiyomi.data.notification.Notifications import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.util.system.notificationBuilder import eu.kanade.tachiyomi.util.system.notificationBuilder
import eu.kanade.tachiyomi.util.system.notify import eu.kanade.tachiyomi.util.system.notify
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.domain.release.model.Release import tachiyomi.domain.release.model.Release
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
@ -53,7 +53,7 @@ internal class AppUpdateNotifier(private val context: Context) {
} }
with(notificationBuilder) { with(notificationBuilder) {
setContentTitle(context.localize(MR.strings.update_check_notification_update_available)) setContentTitle(context.stringResource(MR.strings.update_check_notification_update_available))
setContentText(release.version) setContentText(release.version)
setSmallIcon(android.R.drawable.stat_sys_download_done) setSmallIcon(android.R.drawable.stat_sys_download_done)
setContentIntent(updateIntent) setContentIntent(updateIntent)
@ -61,12 +61,12 @@ internal class AppUpdateNotifier(private val context: Context) {
clearActions() clearActions()
addAction( addAction(
android.R.drawable.stat_sys_download_done, android.R.drawable.stat_sys_download_done,
context.localize(MR.strings.action_download), context.stringResource(MR.strings.action_download),
updateIntent, updateIntent,
) )
addAction( addAction(
R.drawable.ic_info_24dp, R.drawable.ic_info_24dp,
context.localize(MR.strings.whats_new), context.stringResource(MR.strings.whats_new),
releaseIntent, releaseIntent,
) )
} }
@ -81,14 +81,14 @@ internal class AppUpdateNotifier(private val context: Context) {
fun onDownloadStarted(title: String? = null): NotificationCompat.Builder { fun onDownloadStarted(title: String? = null): NotificationCompat.Builder {
with(notificationBuilder) { with(notificationBuilder) {
title?.let { setContentTitle(title) } title?.let { setContentTitle(title) }
setContentText(context.localize(MR.strings.update_check_notification_download_in_progress)) setContentText(context.stringResource(MR.strings.update_check_notification_download_in_progress))
setSmallIcon(android.R.drawable.stat_sys_download) setSmallIcon(android.R.drawable.stat_sys_download)
setOngoing(true) setOngoing(true)
clearActions() clearActions()
addAction( addAction(
R.drawable.ic_close_24dp, R.drawable.ic_close_24dp,
context.localize(MR.strings.action_cancel), context.stringResource(MR.strings.action_cancel),
NotificationReceiver.cancelDownloadAppUpdatePendingBroadcast(context), NotificationReceiver.cancelDownloadAppUpdatePendingBroadcast(context),
) )
} }
@ -117,7 +117,7 @@ internal class AppUpdateNotifier(private val context: Context) {
fun promptInstall(uri: Uri) { fun promptInstall(uri: Uri) {
val installIntent = NotificationHandler.installApkPendingActivity(context, uri) val installIntent = NotificationHandler.installApkPendingActivity(context, uri)
with(notificationBuilder) { with(notificationBuilder) {
setContentText(context.localize(MR.strings.update_check_notification_download_complete)) setContentText(context.stringResource(MR.strings.update_check_notification_download_complete))
setSmallIcon(android.R.drawable.stat_sys_download_done) setSmallIcon(android.R.drawable.stat_sys_download_done)
setOnlyAlertOnce(false) setOnlyAlertOnce(false)
setProgress(0, 0, false) setProgress(0, 0, false)
@ -127,12 +127,12 @@ internal class AppUpdateNotifier(private val context: Context) {
clearActions() clearActions()
addAction( addAction(
R.drawable.ic_system_update_alt_white_24dp, R.drawable.ic_system_update_alt_white_24dp,
context.localize(MR.strings.action_install), context.stringResource(MR.strings.action_install),
installIntent, installIntent,
) )
addAction( addAction(
R.drawable.ic_close_24dp, R.drawable.ic_close_24dp,
context.localize(MR.strings.action_cancel), context.stringResource(MR.strings.action_cancel),
NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_APP_UPDATE_PROMPT), NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_APP_UPDATE_PROMPT),
) )
} }
@ -147,8 +147,8 @@ internal class AppUpdateNotifier(private val context: Context) {
*/ */
fun promptFdroidUpdate() { fun promptFdroidUpdate() {
with(notificationBuilder) { with(notificationBuilder) {
setContentTitle(context.localize(MR.strings.update_check_notification_update_available)) setContentTitle(context.stringResource(MR.strings.update_check_notification_update_available))
setContentText(context.localize(MR.strings.update_check_fdroid_migration_info)) setContentText(context.stringResource(MR.strings.update_check_fdroid_migration_info))
setSmallIcon(R.drawable.ic_tachi) setSmallIcon(R.drawable.ic_tachi)
setContentIntent( setContentIntent(
NotificationHandler.openUrl( NotificationHandler.openUrl(
@ -167,7 +167,7 @@ internal class AppUpdateNotifier(private val context: Context) {
*/ */
fun onDownloadError(url: String) { fun onDownloadError(url: String) {
with(notificationBuilder) { with(notificationBuilder) {
setContentText(context.localize(MR.strings.update_check_notification_download_error)) setContentText(context.stringResource(MR.strings.update_check_notification_download_error))
setSmallIcon(R.drawable.ic_warning_white_24dp) setSmallIcon(R.drawable.ic_warning_white_24dp)
setOnlyAlertOnce(false) setOnlyAlertOnce(false)
setProgress(0, 0, false) setProgress(0, 0, false)
@ -175,12 +175,12 @@ internal class AppUpdateNotifier(private val context: Context) {
clearActions() clearActions()
addAction( addAction(
R.drawable.ic_refresh_24dp, R.drawable.ic_refresh_24dp,
context.localize(MR.strings.action_retry), context.stringResource(MR.strings.action_retry),
NotificationReceiver.downloadAppUpdatePendingBroadcast(context, url), NotificationReceiver.downloadAppUpdatePendingBroadcast(context, url),
) )
addAction( addAction(
R.drawable.ic_close_24dp, R.drawable.ic_close_24dp,
context.localize(MR.strings.action_cancel), context.stringResource(MR.strings.action_cancel),
NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_APP_UPDATER), NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_APP_UPDATER),
) )
} }

View File

@ -7,7 +7,7 @@ import eu.kanade.tachiyomi.data.notification.NotificationReceiver
import eu.kanade.tachiyomi.data.notification.Notifications import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.util.system.cancelNotification import eu.kanade.tachiyomi.util.system.cancelNotification
import eu.kanade.tachiyomi.util.system.notify import eu.kanade.tachiyomi.util.system.notify
import tachiyomi.core.i18n.localizePlural import tachiyomi.core.i18n.pluralStringResource
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
class ExtensionUpdateNotifier(private val context: Context) { class ExtensionUpdateNotifier(private val context: Context) {
@ -18,7 +18,7 @@ class ExtensionUpdateNotifier(private val context: Context) {
Notifications.CHANNEL_EXTENSIONS_UPDATE, Notifications.CHANNEL_EXTENSIONS_UPDATE,
) { ) {
setContentTitle( setContentTitle(
context.localizePlural( context.pluralStringResource(
MR.plurals.update_check_notification_ext_updates, MR.plurals.update_check_notification_ext_updates,
names.size, names.size,
names.size, names.size,

View File

@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.extension.util.ExtensionInstaller.Companion.EXTRA_DOW
import eu.kanade.tachiyomi.util.system.getSerializableExtraCompat import eu.kanade.tachiyomi.util.system.getSerializableExtraCompat
import eu.kanade.tachiyomi.util.system.notificationBuilder import eu.kanade.tachiyomi.util.system.notificationBuilder
import logcat.LogPriority import logcat.LogPriority
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.system.logcat import tachiyomi.core.util.system.logcat
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
@ -29,7 +29,7 @@ class ExtensionInstallService : Service() {
setAutoCancel(false) setAutoCancel(false)
setOngoing(true) setOngoing(true)
setShowWhen(false) setShowWhen(false)
setContentTitle(localize(MR.strings.ext_install_service_notif)) setContentTitle(stringResource(MR.strings.ext_install_service_notif))
setProgress(100, 100, true) setProgress(100, 100, true)
}.build() }.build()
startForeground(Notifications.ID_EXTENSION_INSTALLER, notification) startForeground(Notifications.ID_EXTENSION_INSTALLER, notification)

View File

@ -11,7 +11,7 @@ import cafe.adriel.voyager.navigator.currentOrThrow
import eu.kanade.presentation.browse.ExtensionFilterScreen import eu.kanade.presentation.browse.ExtensionFilterScreen
import eu.kanade.presentation.util.Screen import eu.kanade.presentation.util.Screen
import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.collectLatest
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.screens.LoadingScreen import tachiyomi.presentation.core.screens.LoadingScreen
@ -41,7 +41,7 @@ class ExtensionFilterScreen : Screen() {
screenModel.events.collectLatest { screenModel.events.collectLatest {
when (it) { when (it) {
ExtensionFilterEvent.FailedFetchingLanguages -> { ExtensionFilterEvent.FailedFetchingLanguages -> {
context.localize(MR.strings.internal_error) context.stringResource(MR.strings.internal_error)
} }
} }
} }

View File

@ -14,7 +14,7 @@ import eu.kanade.tachiyomi.extension.model.Extension
import eu.kanade.tachiyomi.ui.browse.extension.details.ExtensionDetailsScreen import eu.kanade.tachiyomi.ui.browse.extension.details.ExtensionDetailsScreen
import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
@Composable @Composable
fun extensionsTab( fun extensionsTab(
@ -29,7 +29,7 @@ fun extensionsTab(
searchEnabled = true, searchEnabled = true,
actions = persistentListOf( actions = persistentListOf(
AppBar.Action( AppBar.Action(
title = localize(MR.strings.action_filter), title = stringResource(MR.strings.action_filter),
icon = Icons.Outlined.Translate, icon = Icons.Outlined.Translate,
onClick = { navigator.push(ExtensionFilterScreen()) }, onClick = { navigator.push(ExtensionFilterScreen()) },
), ),

View File

@ -16,7 +16,7 @@ import eu.kanade.tachiyomi.ui.manga.MangaScreen
import eu.kanade.tachiyomi.ui.reader.ReaderActivity import eu.kanade.tachiyomi.ui.reader.ReaderActivity
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.LoadingScreen import tachiyomi.presentation.core.screens.LoadingScreen
class DeepLinkScreen( class DeepLinkScreen(
@ -35,7 +35,7 @@ class DeepLinkScreen(
Scaffold( Scaffold(
topBar = { scrollBehavior -> topBar = { scrollBehavior ->
AppBar( AppBar(
title = localize(MR.strings.action_search_hint), title = stringResource(MR.strings.action_search_hint),
navigateUp = navigator::pop, navigateUp = navigator::pop,
scrollBehavior = scrollBehavior, scrollBehavior = scrollBehavior,
) )

View File

@ -58,7 +58,7 @@ import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.Pill import tachiyomi.presentation.core.components.Pill
import tachiyomi.presentation.core.components.material.ExtendedFloatingActionButton import tachiyomi.presentation.core.components.material.ExtendedFloatingActionButton
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen import tachiyomi.presentation.core.screens.EmptyScreen
import kotlin.math.roundToInt import kotlin.math.roundToInt
@ -104,7 +104,7 @@ object DownloadQueueScreen : Screen() {
titleContent = { titleContent = {
Row(verticalAlignment = Alignment.CenterVertically) { Row(verticalAlignment = Alignment.CenterVertically) {
Text( Text(
text = localize(MR.strings.label_download_queue), text = stringResource(MR.strings.label_download_queue),
maxLines = 1, maxLines = 1,
modifier = Modifier.weight(1f, false), modifier = Modifier.weight(1f, false),
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
@ -131,10 +131,10 @@ object DownloadQueueScreen : Screen() {
onDismissRequest = onDismissRequest, onDismissRequest = onDismissRequest,
) { ) {
NestedMenuItem( NestedMenuItem(
text = { Text(text = localize(MR.strings.action_order_by_upload_date)) }, text = { Text(text = stringResource(MR.strings.action_order_by_upload_date)) },
children = { closeMenu -> children = { closeMenu ->
DropdownMenuItem( DropdownMenuItem(
text = { Text(text = localize(MR.strings.action_newest)) }, text = { Text(text = stringResource(MR.strings.action_newest)) },
onClick = { onClick = {
screenModel.reorderQueue( screenModel.reorderQueue(
{ it.download.chapter.dateUpload }, { it.download.chapter.dateUpload },
@ -144,7 +144,7 @@ object DownloadQueueScreen : Screen() {
}, },
) )
DropdownMenuItem( DropdownMenuItem(
text = { Text(text = localize(MR.strings.action_oldest)) }, text = { Text(text = stringResource(MR.strings.action_oldest)) },
onClick = { onClick = {
screenModel.reorderQueue( screenModel.reorderQueue(
{ it.download.chapter.dateUpload }, { it.download.chapter.dateUpload },
@ -156,10 +156,10 @@ object DownloadQueueScreen : Screen() {
}, },
) )
NestedMenuItem( NestedMenuItem(
text = { Text(text = localize(MR.strings.action_order_by_chapter_number)) }, text = { Text(text = stringResource(MR.strings.action_order_by_chapter_number)) },
children = { closeMenu -> children = { closeMenu ->
DropdownMenuItem( DropdownMenuItem(
text = { Text(text = localize(MR.strings.action_asc)) }, text = { Text(text = stringResource(MR.strings.action_asc)) },
onClick = { onClick = {
screenModel.reorderQueue( screenModel.reorderQueue(
{ it.download.chapter.chapterNumber }, { it.download.chapter.chapterNumber },
@ -169,7 +169,7 @@ object DownloadQueueScreen : Screen() {
}, },
) )
DropdownMenuItem( DropdownMenuItem(
text = { Text(text = localize(MR.strings.action_desc)) }, text = { Text(text = stringResource(MR.strings.action_desc)) },
onClick = { onClick = {
screenModel.reorderQueue( screenModel.reorderQueue(
{ it.download.chapter.chapterNumber }, { it.download.chapter.chapterNumber },
@ -185,12 +185,12 @@ object DownloadQueueScreen : Screen() {
AppBarActions( AppBarActions(
persistentListOf( persistentListOf(
AppBar.Action( AppBar.Action(
title = localize(MR.strings.action_sort), title = stringResource(MR.strings.action_sort),
icon = Icons.AutoMirrored.Outlined.Sort, icon = Icons.AutoMirrored.Outlined.Sort,
onClick = { sortExpanded = true }, onClick = { sortExpanded = true },
), ),
AppBar.OverflowAction( AppBar.OverflowAction(
title = localize(MR.strings.action_cancel_all), title = stringResource(MR.strings.action_cancel_all),
onClick = { screenModel.clearQueue() }, onClick = { screenModel.clearQueue() },
), ),
), ),
@ -214,7 +214,7 @@ object DownloadQueueScreen : Screen() {
} else { } else {
MR.strings.action_resume MR.strings.action_resume
} }
Text(text = localize(id)) Text(text = stringResource(id))
}, },
icon = { icon = {
val icon = if (isRunning) { val icon = if (isRunning) {

View File

@ -59,7 +59,7 @@ import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.NavigationBar import tachiyomi.presentation.core.components.material.NavigationBar
import tachiyomi.presentation.core.components.material.NavigationRail import tachiyomi.presentation.core.components.material.NavigationRail
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localizePlural import tachiyomi.presentation.core.i18n.pluralStringResource
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
@ -262,7 +262,7 @@ object HomeScreen : Screen() {
} }
if (count > 0) { if (count > 0) {
Badge { Badge {
val desc = localizePlural( val desc = pluralStringResource(
MR.plurals.notification_chapters_generic, MR.plurals.notification_chapters_generic,
count = count, count = count,
count, count,
@ -281,7 +281,7 @@ object HomeScreen : Screen() {
} }
if (count > 0) { if (count > 0) {
Badge { Badge {
val desc = localizePlural( val desc = pluralStringResource(
MR.plurals.update_check_notification_ext_updates, MR.plurals.update_check_notification_ext_updates,
count = count, count = count,
count, count,

View File

@ -55,7 +55,7 @@ import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.flow.receiveAsFlow
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.lang.launchIO import tachiyomi.core.util.lang.launchIO
import tachiyomi.domain.UnsortedPreferences import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.category.model.Category import tachiyomi.domain.category.model.Category
@ -64,7 +64,7 @@ import tachiyomi.domain.library.model.LibraryManga
import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.screens.EmptyScreenAction import tachiyomi.presentation.core.screens.EmptyScreenAction
import tachiyomi.presentation.core.screens.LoadingScreen import tachiyomi.presentation.core.screens.LoadingScreen
@ -81,7 +81,7 @@ object LibraryTab : Tab {
val image = AnimatedImageVector.animatedVectorResource(R.drawable.anim_library_enter) val image = AnimatedImageVector.animatedVectorResource(R.drawable.anim_library_enter)
return TabOptions( return TabOptions(
index = 0u, index = 0u,
title = localize(MR.strings.label_library), title = stringResource(MR.strings.label_library),
icon = rememberAnimatedVectorPainter(image, isSelected), icon = rememberAnimatedVectorPainter(image, isSelected),
) )
} }
@ -123,7 +123,7 @@ object LibraryTab : Tab {
category != null -> MR.strings.updating_category category != null -> MR.strings.updating_category
else -> MR.strings.updating_library else -> MR.strings.updating_library
} }
snackbarHostState.showSnackbar(context.localize(msgRes)) snackbarHostState.showSnackbar(context.stringResource(msgRes))
} }
started started
} }
@ -131,8 +131,8 @@ object LibraryTab : Tab {
Scaffold( Scaffold(
topBar = { scrollBehavior -> topBar = { scrollBehavior ->
val title = state.getToolbarTitle( val title = state.getToolbarTitle(
defaultTitle = localize(MR.strings.label_library), defaultTitle = stringResource(MR.strings.label_library),
defaultCategoryTitle = localize(MR.strings.label_default), defaultCategoryTitle = stringResource(MR.strings.label_default),
page = screenModel.activeCategoryIndex, page = screenModel.activeCategoryIndex,
) )
val tabVisible = state.showCategoryTabs && state.categories.size > 1 val tabVisible = state.showCategoryTabs && state.categories.size > 1
@ -155,7 +155,7 @@ object LibraryTab : Tab {
navigator.push(MangaScreen(randomItem.libraryManga.manga.id)) navigator.push(MangaScreen(randomItem.libraryManga.manga.id))
} else { } else {
snackbarHostState.showSnackbar( snackbarHostState.showSnackbar(
context.localize(MR.strings.information_no_entries_found), context.stringResource(MR.strings.information_no_entries_found),
) )
} }
} }
@ -235,7 +235,7 @@ object LibraryTab : Tab {
ReaderActivity.newIntent(context, chapter.mangaId, chapter.id), ReaderActivity.newIntent(context, chapter.mangaId, chapter.id),
) )
} else { } else {
snackbarHostState.showSnackbar(context.localize(MR.strings.no_next_chapter)) snackbarHostState.showSnackbar(context.stringResource(MR.strings.no_next_chapter))
} }
} }
Unit Unit

View File

@ -19,7 +19,7 @@ import eu.kanade.tachiyomi.util.system.toShareIntent
import kotlinx.coroutines.flow.update import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import logcat.LogPriority import logcat.LogPriority
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.lang.launchIO import tachiyomi.core.util.lang.launchIO
import tachiyomi.core.util.lang.withIOContext import tachiyomi.core.util.lang.withIOContext
import tachiyomi.core.util.lang.withUIContext import tachiyomi.core.util.lang.withUIContext
@ -52,13 +52,13 @@ class MangaCoverScreenModel(
try { try {
saveCoverInternal(context, temp = false) saveCoverInternal(context, temp = false)
snackbarHostState.showSnackbar( snackbarHostState.showSnackbar(
context.localize(MR.strings.cover_saved), context.stringResource(MR.strings.cover_saved),
withDismissAction = true, withDismissAction = true,
) )
} catch (e: Throwable) { } catch (e: Throwable) {
logcat(LogPriority.ERROR, e) logcat(LogPriority.ERROR, e)
snackbarHostState.showSnackbar( snackbarHostState.showSnackbar(
context.localize(MR.strings.error_saving_cover), context.stringResource(MR.strings.error_saving_cover),
withDismissAction = true, withDismissAction = true,
) )
} }
@ -75,7 +75,7 @@ class MangaCoverScreenModel(
} catch (e: Throwable) { } catch (e: Throwable) {
logcat(LogPriority.ERROR, e) logcat(LogPriority.ERROR, e)
snackbarHostState.showSnackbar( snackbarHostState.showSnackbar(
context.localize(MR.strings.error_sharing_cover), context.stringResource(MR.strings.error_sharing_cover),
withDismissAction = true, withDismissAction = true,
) )
} }
@ -146,7 +146,7 @@ class MangaCoverScreenModel(
private fun notifyCoverUpdated(context: Context) { private fun notifyCoverUpdated(context: Context) {
screenModelScope.launch { screenModelScope.launch {
snackbarHostState.showSnackbar( snackbarHostState.showSnackbar(
context.localize(MR.strings.cover_updated), context.stringResource(MR.strings.cover_updated),
withDismissAction = true, withDismissAction = true,
) )
} }
@ -155,7 +155,7 @@ class MangaCoverScreenModel(
private fun notifyFailedCoverUpdate(context: Context, e: Throwable) { private fun notifyFailedCoverUpdate(context: Context, e: Throwable) {
screenModelScope.launch { screenModelScope.launch {
snackbarHostState.showSnackbar( snackbarHostState.showSnackbar(
context.localize(MR.strings.notification_cover_update_failed), context.stringResource(MR.strings.notification_cover_update_failed),
withDismissAction = true, withDismissAction = true,
) )
logcat(LogPriority.ERROR, e) logcat(LogPriority.ERROR, e)

View File

@ -65,7 +65,7 @@ import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.update import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import logcat.LogPriority import logcat.LogPriority
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.lang.launchNonCancellable import tachiyomi.core.util.lang.launchNonCancellable
import tachiyomi.core.util.lang.withIOContext import tachiyomi.core.util.lang.withIOContext
import tachiyomi.core.util.lang.withUIContext import tachiyomi.core.util.lang.withUIContext
@ -79,7 +79,7 @@ import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.LabeledCheckbox import tachiyomi.presentation.core.components.LabeledCheckbox
import tachiyomi.presentation.core.components.material.AlertDialogContent import tachiyomi.presentation.core.components.material.AlertDialogContent
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.time.Instant import java.time.Instant
@ -229,7 +229,7 @@ data class TrackInfoDialogHomeScreen(
} }
withUIContext { withUIContext {
context.toast( context.toast(
context.localize( context.stringResource(
MR.strings.track_error, MR.strings.track_error,
track!!.name, track!!.name,
e.message ?: "", e.message ?: "",
@ -502,9 +502,9 @@ private data class TrackDateSelectorScreen(
} }
TrackDateSelector( TrackDateSelector(
title = if (start) { title = if (start) {
localize(MR.strings.track_started_reading_date) stringResource(MR.strings.track_started_reading_date)
} else { } else {
localize(MR.strings.track_finished_reading_date) stringResource(MR.strings.track_finished_reading_date)
}, },
initialSelectedDateMillis = screenModel.initialSelection, initialSelectedDateMillis = screenModel.initialSelection,
selectableDates = selectableDates, selectableDates = selectableDates,
@ -577,7 +577,7 @@ private data class TrackDateRemoverScreen(
}, },
title = { title = {
Text( Text(
text = localize(MR.strings.track_remove_date_conf_title), text = stringResource(MR.strings.track_remove_date_conf_title),
textAlign = TextAlign.Center, textAlign = TextAlign.Center,
) )
}, },
@ -585,9 +585,9 @@ private data class TrackDateRemoverScreen(
val serviceName = screenModel.getServiceName() val serviceName = screenModel.getServiceName()
Text( Text(
text = if (start) { text = if (start) {
localize(MR.strings.track_remove_start_date_conf_text, serviceName) stringResource(MR.strings.track_remove_start_date_conf_text, serviceName)
} else { } else {
localize(MR.strings.track_remove_finish_date_conf_text, serviceName) stringResource(MR.strings.track_remove_finish_date_conf_text, serviceName)
}, },
) )
}, },
@ -597,7 +597,7 @@ private data class TrackDateRemoverScreen(
horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small, Alignment.End), horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small, Alignment.End),
) { ) {
TextButton(onClick = navigator::pop) { TextButton(onClick = navigator::pop) {
Text(text = localize(MR.strings.action_cancel)) Text(text = stringResource(MR.strings.action_cancel))
} }
FilledTonalButton( FilledTonalButton(
onClick = { onClick = {
@ -609,7 +609,7 @@ private data class TrackDateRemoverScreen(
contentColor = MaterialTheme.colorScheme.onErrorContainer, contentColor = MaterialTheme.colorScheme.onErrorContainer,
), ),
) { ) {
Text(text = localize(MR.strings.action_remove)) Text(text = stringResource(MR.strings.action_remove))
} }
} }
}, },
@ -753,7 +753,7 @@ private data class TrackerRemoveScreen(
}, },
title = { title = {
Text( Text(
text = localize(MR.strings.track_delete_title, serviceName), text = stringResource(MR.strings.track_delete_title, serviceName),
textAlign = TextAlign.Center, textAlign = TextAlign.Center,
) )
}, },
@ -762,12 +762,12 @@ private data class TrackerRemoveScreen(
verticalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(8.dp),
) { ) {
Text( Text(
text = localize(MR.strings.track_delete_text, serviceName), text = stringResource(MR.strings.track_delete_text, serviceName),
) )
if (screenModel.isDeletable()) { if (screenModel.isDeletable()) {
LabeledCheckbox( LabeledCheckbox(
label = localize(MR.strings.track_delete_remote_text, serviceName), label = stringResource(MR.strings.track_delete_remote_text, serviceName),
checked = removeRemoteTrack, checked = removeRemoteTrack,
onCheckedChange = { removeRemoteTrack = it }, onCheckedChange = { removeRemoteTrack = it },
) )
@ -783,7 +783,7 @@ private data class TrackerRemoveScreen(
), ),
) { ) {
TextButton(onClick = navigator::pop) { TextButton(onClick = navigator::pop) {
Text(text = localize(MR.strings.action_cancel)) Text(text = stringResource(MR.strings.action_cancel))
} }
FilledTonalButton( FilledTonalButton(
onClick = { onClick = {
@ -796,7 +796,7 @@ private data class TrackerRemoveScreen(
contentColor = MaterialTheme.colorScheme.onErrorContainer, contentColor = MaterialTheme.colorScheme.onErrorContainer,
), ),
) { ) {
Text(text = localize(MR.strings.action_ok)) Text(text = stringResource(MR.strings.action_ok))
} }
} }
}, },

View File

@ -38,7 +38,7 @@ import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.combine
import tachiyomi.core.util.lang.launchIO import tachiyomi.core.util.lang.launchIO
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize import tachiyomi.presentation.core.i18n.stringResource
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
@ -51,7 +51,7 @@ object MoreTab : Tab {
val image = AnimatedImageVector.animatedVectorResource(R.drawable.anim_more_enter) val image = AnimatedImageVector.animatedVectorResource(R.drawable.anim_more_enter)
return TabOptions( return TabOptions(
index = 4u, index = 4u,
title = localize(MR.strings.label_more), title = stringResource(MR.strings.label_more),
icon = rememberAnimatedVectorPainter(image, isSelected), icon = rememberAnimatedVectorPainter(image, isSelected),
) )
} }

View File

@ -13,7 +13,7 @@ import androidx.core.graphics.withTranslation
import androidx.core.view.isVisible import androidx.core.view.isVisible
import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation
import eu.kanade.tachiyomi.ui.reader.viewer.navigation.DisabledNavigation import eu.kanade.tachiyomi.ui.reader.viewer.navigation.DisabledNavigation
import tachiyomi.core.i18n.localize import tachiyomi.core.i18n.stringResource
import kotlin.math.abs import kotlin.math.abs
class ReaderNavigationOverlayView(context: Context, attributeSet: AttributeSet) : View(context, attributeSet) { class ReaderNavigationOverlayView(context: Context, attributeSet: AttributeSet) : View(context, attributeSet) {
@ -80,8 +80,8 @@ class ReaderNavigationOverlayView(context: Context, attributeSet: AttributeSet)
// Calculate center of rect height on screen // Calculate center of rect height on screen
val y = height * (abs(rect.top - rect.bottom) / 2) val y = height * (abs(rect.top - rect.bottom) / 2)
drawText(context.localize(region.type.nameRes), x, y, textBorderPaint) drawText(context.stringResource(region.type.nameRes), x, y, textBorderPaint)
drawText(context.localize(region.type.nameRes), x, y, textPaint) drawText(context.stringResource(region.type.nameRes), x, y, textPaint)
} }
} }
} }

Some files were not shown because too many files have changed in this diff Show More