Replace remaining Android-specific strings

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

View File

@@ -24,7 +24,7 @@ import eu.kanade.tachiyomi.ui.browse.source.sourcesTab
import eu.kanade.tachiyomi.ui.main.MainActivity
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
data class BrowseTab(
private val toExtensions: Boolean = false,
@@ -37,7 +37,7 @@ data class BrowseTab(
val image = AnimatedImageVector.animatedVectorResource(R.drawable.anim_browse_enter)
return TabOptions(
index = 3u,
title = localize(MR.strings.browse),
title = stringResource(MR.strings.browse),
icon = rememberAnimatedVectorPainter(image, isSelected),
)
}

View File

@@ -11,7 +11,7 @@ import cafe.adriel.voyager.navigator.currentOrThrow
import eu.kanade.presentation.browse.ExtensionFilterScreen
import eu.kanade.presentation.util.Screen
import kotlinx.coroutines.flow.collectLatest
import tachiyomi.core.i18n.localize
import tachiyomi.core.i18n.stringResource
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.screens.LoadingScreen
@@ -41,7 +41,7 @@ class ExtensionFilterScreen : Screen() {
screenModel.events.collectLatest {
when (it) {
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 kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun extensionsTab(
@@ -29,7 +29,7 @@ fun extensionsTab(
searchEnabled = true,
actions = persistentListOf(
AppBar.Action(
title = localize(MR.strings.action_filter),
title = stringResource(MR.strings.action_filter),
icon = Icons.Outlined.Translate,
onClick = { navigator.push(ExtensionFilterScreen()) },
),

View File

@@ -49,7 +49,7 @@ import tachiyomi.domain.track.interactor.GetTracks
import tachiyomi.domain.track.interactor.InsertTrack
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.LabeledCheckbox
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.LoadingScreen
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@@ -79,7 +79,7 @@ internal fun MigrateDialog(
AlertDialog(
onDismissRequest = onDismissRequest,
title = {
Text(text = localize(MR.strings.migration_dialog_what_to_include))
Text(text = stringResource(MR.strings.migration_dialog_what_to_include))
},
text = {
Column(
@@ -87,7 +87,7 @@ internal fun MigrateDialog(
) {
flags.forEachIndexed { index, flag ->
LabeledCheckbox(
label = localize(flag.titleId),
label = stringResource(flag.titleId),
checked = selectedFlags[index],
onCheckedChange = { selectedFlags[index] = it },
)
@@ -104,7 +104,7 @@ internal fun MigrateDialog(
onClickTitle()
},
) {
Text(text = localize(MR.strings.action_show_manga))
Text(text = stringResource(MR.strings.action_show_manga))
}
Spacer(modifier = Modifier.weight(1f))
@@ -122,7 +122,7 @@ internal fun MigrateDialog(
}
},
) {
Text(text = localize(MR.strings.copy))
Text(text = stringResource(MR.strings.copy))
}
TextButton(
onClick = {
@@ -138,7 +138,7 @@ internal fun MigrateDialog(
}
},
) {
Text(text = localize(MR.strings.migrate))
Text(text = stringResource(MR.strings.migrate))
}
}
},

View File

@@ -33,7 +33,7 @@ import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.ExtendedFloatingActionButton
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.source.local.LocalSource
data class SourceSearchScreen(
@@ -66,7 +66,7 @@ data class SourceSearchScreen(
floatingActionButton = {
AnimatedVisibility(visible = state.filters.isNotEmpty()) {
ExtendedFloatingActionButton(
text = { Text(text = localize(MR.strings.action_filter)) },
text = { Text(text = stringResource(MR.strings.action_filter)) },
icon = { Icon(Icons.Outlined.FilterList, contentDescription = null) },
onClick = screenModel::openFilterSheet,
)

View File

@@ -16,7 +16,7 @@ import eu.kanade.presentation.components.TabContent
import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrateMangaScreen
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun Screen.migrateSourceTab(): TabContent {
@@ -29,7 +29,7 @@ fun Screen.migrateSourceTab(): TabContent {
titleRes = MR.strings.label_migration,
actions = persistentListOf(
AppBar.Action(
title = localize(MR.strings.migration_help_guide),
title = stringResource(MR.strings.migration_help_guide),
icon = Icons.AutoMirrored.Outlined.HelpOutline,
onClick = {
uriHandler.openUri("https://tachiyomi.org/docs/guides/source-migration")

View File

@@ -21,7 +21,7 @@ import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun Screen.sourcesTab(): TabContent {
@@ -33,12 +33,12 @@ fun Screen.sourcesTab(): TabContent {
titleRes = MR.strings.label_sources,
actions = persistentListOf(
AppBar.Action(
title = localize(MR.strings.action_global_search),
title = stringResource(MR.strings.action_global_search),
icon = Icons.Outlined.TravelExplore,
onClick = { navigator.push(GlobalSearchScreen()) },
),
AppBar.Action(
title = localize(MR.strings.action_filter),
title = stringResource(MR.strings.action_filter),
icon = Icons.Outlined.FilterList,
onClick = { navigator.push(SourcesFilterScreen()) },
),
@@ -70,7 +70,7 @@ fun Screen.sourcesTab(): TabContent {
)
}
val internalErrString = localize(MR.strings.internal_error)
val internalErrString = stringResource(MR.strings.internal_error)
LaunchedEffect(Unit) {
screenModel.events.collectLatest { event ->
when (event) {

View File

@@ -59,7 +59,7 @@ import tachiyomi.domain.source.model.StubSource
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.source.local.LocalSource
data class BrowseSourceScreen(
@@ -150,7 +150,7 @@ data class BrowseSourceScreen(
)
},
label = {
Text(text = localize(MR.strings.popular))
Text(text = stringResource(MR.strings.popular))
},
)
if ((screenModel.source as CatalogueSource).supportsLatest) {
@@ -169,7 +169,7 @@ data class BrowseSourceScreen(
)
},
label = {
Text(text = localize(MR.strings.latest))
Text(text = stringResource(MR.strings.latest))
},
)
}
@@ -186,7 +186,7 @@ data class BrowseSourceScreen(
)
},
label = {
Text(text = localize(MR.strings.action_filter))
Text(text = stringResource(MR.strings.action_filter))
},
)
}

View File

@@ -28,7 +28,7 @@ import tachiyomi.presentation.core.components.SortItem
import tachiyomi.presentation.core.components.TextItem
import tachiyomi.presentation.core.components.TriStateItem
import tachiyomi.presentation.core.components.material.Button
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun SourceFilterDialog(
@@ -52,7 +52,7 @@ fun SourceFilterDialog(
) {
TextButton(onClick = onReset) {
Text(
text = localize(MR.strings.action_reset),
text = stringResource(MR.strings.action_reset),
style = LocalTextStyle.current.copy(
color = MaterialTheme.colorScheme.primary,
),
@@ -65,7 +65,7 @@ fun SourceFilterDialog(
onFilter()
onDismissRequest()
}) {
Text(localize(MR.strings.action_filter))
Text(stringResource(MR.strings.action_filter))
}
}
HorizontalDivider()

View File

@@ -16,7 +16,7 @@ import eu.kanade.tachiyomi.ui.manga.MangaScreen
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
import tachiyomi.i18n.MR
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
class DeepLinkScreen(
@@ -35,7 +35,7 @@ class DeepLinkScreen(
Scaffold(
topBar = { scrollBehavior ->
AppBar(
title = localize(MR.strings.action_search_hint),
title = stringResource(MR.strings.action_search_hint),
navigateUp = navigator::pop,
scrollBehavior = scrollBehavior,
)

View File

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

View File

@@ -27,10 +27,10 @@ import eu.kanade.tachiyomi.ui.reader.ReaderActivity
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.receiveAsFlow
import tachiyomi.core.i18n.localize
import tachiyomi.core.i18n.stringResource
import tachiyomi.domain.chapter.model.Chapter
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
object HistoryTab : Tab {
@@ -45,7 +45,7 @@ object HistoryTab : Tab {
val image = AnimatedImageVector.animatedVectorResource(R.drawable.anim_history_enter)
return TabOptions(
index = 2u,
title = localize(MR.strings.label_recent_manga),
title = stringResource(MR.strings.label_recent_manga),
icon = rememberAnimatedVectorPainter(image, isSelected),
)
}
@@ -103,9 +103,9 @@ object HistoryTab : Tab {
screenModel.events.collectLatest { e ->
when (e) {
HistoryScreenModel.Event.InternalError ->
snackbarHostState.showSnackbar(context.localize(MR.strings.internal_error))
snackbarHostState.showSnackbar(context.stringResource(MR.strings.internal_error))
HistoryScreenModel.Event.HistoryCleared ->
snackbarHostState.showSnackbar(context.localize(MR.strings.clear_history_completed))
snackbarHostState.showSnackbar(context.stringResource(MR.strings.clear_history_completed))
is HistoryScreenModel.Event.OpenChapter -> openChapter(context, e.chapter)
}
}
@@ -123,7 +123,7 @@ object HistoryTab : Tab {
val intent = ReaderActivity.newIntent(context, chapter.mangaId, chapter.id)
context.startActivity(intent)
} else {
snackbarHostState.showSnackbar(context.localize(MR.strings.no_next_chapter))
snackbarHostState.showSnackbar(context.stringResource(MR.strings.no_next_chapter))
}
}
}

View File

@@ -55,7 +55,7 @@ import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.NavigationBar
import tachiyomi.presentation.core.components.material.NavigationRail
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.api.get
@@ -241,7 +241,7 @@ object HomeScreen : Screen() {
}
if (count > 0) {
Badge {
val desc = localizePlural(
val desc = pluralStringResource(
MR.plurals.notification_chapters_generic,
count = count,
count,
@@ -260,7 +260,7 @@ object HomeScreen : Screen() {
}
if (count > 0) {
Badge {
val desc = localizePlural(
val desc = pluralStringResource(
MR.plurals.update_check_notification_ext_updates,
count = count,
count,

View File

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

View File

@@ -93,7 +93,7 @@ import tachiyomi.domain.library.service.LibraryPreferences
import tachiyomi.domain.release.interactor.GetApplicationRelease
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@@ -257,15 +257,15 @@ class MainActivity : BaseActivity() {
if (showChangelog) {
AlertDialog(
onDismissRequest = { showChangelog = false },
title = { Text(text = localize(MR.strings.updated_version, BuildConfig.VERSION_NAME)) },
title = { Text(text = stringResource(MR.strings.updated_version, BuildConfig.VERSION_NAME)) },
dismissButton = {
TextButton(onClick = { openInBrowser(RELEASE_URL) }) {
Text(text = localize(MR.strings.whats_new))
Text(text = stringResource(MR.strings.whats_new))
}
},
confirmButton = {
TextButton(onClick = { showChangelog = false }) {
Text(text = localize(MR.strings.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
)

View File

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

View File

@@ -53,7 +53,7 @@ import eu.kanade.tachiyomi.util.system.toShareIntent
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.coroutines.launch
import logcat.LogPriority
import tachiyomi.core.i18n.localize
import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.lang.withIOContext
import tachiyomi.core.util.system.logcat
import tachiyomi.domain.chapter.model.Chapter
@@ -292,7 +292,7 @@ class MangaScreen(
context.startActivity(
Intent.createChooser(
intent,
context.localize(MR.strings.action_share),
context.stringResource(MR.strings.action_share),
),
)
}

View File

@@ -49,7 +49,7 @@ import kotlinx.coroutines.flow.update
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import logcat.LogPriority
import tachiyomi.core.i18n.localize
import tachiyomi.core.i18n.stringResource
import tachiyomi.core.preference.CheckboxState
import tachiyomi.core.preference.TriState
import tachiyomi.core.preference.mapAsCheckboxState
@@ -282,8 +282,8 @@ class MangaScreenModel(
screenModelScope.launch {
if (!hasDownloads()) return@launch
val result = snackbarHostState.showSnackbar(
message = context.localize(MR.strings.delete_downloads_for_manga),
actionLabel = context.localize(MR.strings.action_delete),
message = context.stringResource(MR.strings.delete_downloads_for_manga),
actionLabel = context.stringResource(MR.strings.action_delete),
withDismissAction = true,
)
if (result == SnackbarResult.ActionPerformed) {
@@ -551,7 +551,7 @@ class MangaScreenModel(
}
} catch (e: Throwable) {
val message = if (e is NoChaptersException) {
context.localize(MR.strings.no_chapters_error)
context.stringResource(MR.strings.no_chapters_error)
} else {
logcat(LogPriority.ERROR, e)
with(context) { e.formattedMessage }
@@ -648,8 +648,8 @@ class MangaScreenModel(
}
screenModelScope.launch {
val result = snackbarHostState.showSnackbar(
message = context.localize(MR.strings.snack_add_to_library),
actionLabel = context.localize(MR.strings.action_add),
message = context.stringResource(MR.strings.snack_add_to_library),
actionLabel = context.stringResource(MR.strings.action_add),
withDismissAction = true,
)
if (result == SnackbarResult.ActionPerformed && !isFavorited) {
@@ -870,7 +870,7 @@ class MangaScreenModel(
if (applyToExisting) {
setMangaDefaultChapterFlags.awaitAll()
}
snackbarHostState.showSnackbar(message = context.localize(MR.strings.chapter_settings_updated))
snackbarHostState.showSnackbar(message = context.stringResource(MR.strings.chapter_settings_updated))
}
}

View File

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

View File

@@ -34,7 +34,7 @@ import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.combine
import tachiyomi.core.util.lang.launchIO
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.api.get
@@ -47,7 +47,7 @@ object MoreTab : Tab {
val image = AnimatedImageVector.animatedVectorResource(R.drawable.anim_more_enter)
return TabOptions(
index = 4u,
title = localize(MR.strings.label_more),
title = stringResource(MR.strings.label_more),
icon = rememberAnimatedVectorPainter(image, isSelected),
)
}

View File

@@ -84,7 +84,7 @@ import kotlinx.coroutines.flow.sample
import kotlinx.coroutines.launch
import logcat.LogPriority
import tachiyomi.core.Constants
import tachiyomi.core.i18n.localize
import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.lang.launchIO
import tachiyomi.core.util.lang.launchNonCancellable
import tachiyomi.core.util.lang.withUIContext
@@ -400,7 +400,7 @@ class ReaderActivity : BaseActivity() {
verticalAlignment = Alignment.CenterVertically,
) {
CircularProgressIndicator()
Text(localize(MR.strings.loading))
Text(stringResource(MR.strings.loading))
}
},
)
@@ -537,7 +537,7 @@ class ReaderActivity : BaseActivity() {
private fun shareChapter() {
assistUrl?.let {
val intent = it.toUri().toShareIntent(this, type = "text/plain")
startActivity(Intent.createChooser(intent, localize(MR.strings.action_share)))
startActivity(Intent.createChooser(intent, stringResource(MR.strings.action_share)))
}
}
@@ -684,9 +684,9 @@ class ReaderActivity : BaseActivity() {
val intent = uri.toShareIntent(
context = applicationContext,
message = localize(MR.strings.share_page_info, manga.title, chapter.name, page.number),
message = stringResource(MR.strings.share_page_info, manga.title, chapter.name, page.number),
)
startActivity(Intent.createChooser(intent, localize(MR.strings.action_share)))
startActivity(Intent.createChooser(intent, stringResource(MR.strings.action_share)))
}
/**

View File

@@ -13,7 +13,7 @@ import androidx.core.graphics.withTranslation
import androidx.core.view.isVisible
import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation
import eu.kanade.tachiyomi.ui.reader.viewer.navigation.DisabledNavigation
import tachiyomi.core.i18n.localize
import tachiyomi.core.i18n.stringResource
import kotlin.math.abs
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
val y = height * (abs(rect.top - rect.bottom) / 2)
drawText(context.localize(region.type.nameRes), x, y, textBorderPaint)
drawText(context.localize(region.type.nameRes), x, y, textPaint)
drawText(context.stringResource(region.type.nameRes), x, y, textBorderPaint)
drawText(context.stringResource(region.type.nameRes), x, y, textPaint)
}
}
}

View File

@@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.util.system.cancelNotification
import eu.kanade.tachiyomi.util.system.getBitmapOrNull
import eu.kanade.tachiyomi.util.system.notificationBuilder
import eu.kanade.tachiyomi.util.system.notify
import tachiyomi.core.i18n.localize
import tachiyomi.core.i18n.stringResource
import tachiyomi.i18n.MR
/**
@@ -58,8 +58,8 @@ class SaveImageNotifier(private val context: Context) {
fun onError(error: String?) {
// Create notification
with(notificationBuilder) {
setContentTitle(context.localize(MR.strings.download_notifier_title_error))
setContentText(error ?: context.localize(MR.strings.unknown_error))
setContentTitle(context.stringResource(MR.strings.download_notifier_title_error))
setContentText(error ?: context.stringResource(MR.strings.unknown_error))
setSmallIcon(android.R.drawable.ic_menu_report_image)
}
updateNotification()
@@ -67,7 +67,7 @@ class SaveImageNotifier(private val context: Context) {
private fun showCompleteNotification(uri: Uri, image: Bitmap?) {
with(notificationBuilder) {
setContentTitle(context.localize(MR.strings.picture_saved))
setContentTitle(context.stringResource(MR.strings.picture_saved))
setSmallIcon(R.drawable.ic_photo_24dp)
image?.let { setStyle(NotificationCompat.BigPictureStyle().bigPicture(it)) }
setLargeIcon(image)
@@ -80,13 +80,13 @@ class SaveImageNotifier(private val context: Context) {
// Share action
addAction(
R.drawable.ic_share_24dp,
context.localize(MR.strings.action_share),
context.stringResource(MR.strings.action_share),
NotificationReceiver.shareImagePendingBroadcast(context, uri.path!!, notificationId),
)
// Delete action
addAction(
R.drawable.ic_delete_24dp,
context.localize(MR.strings.action_delete),
context.stringResource(MR.strings.action_delete),
NotificationReceiver.deleteImagePendingBroadcast(context, uri.path!!, notificationId),
)

View File

@@ -7,7 +7,7 @@ import eu.kanade.tachiyomi.data.download.DownloadProvider
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.online.HttpSource
import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter
import tachiyomi.core.i18n.localize
import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.lang.withIOContext
import tachiyomi.core.util.system.logcat
import tachiyomi.domain.manga.model.Manga
@@ -47,7 +47,7 @@ class ChapterLoader(
.onEach { it.chapter = chapter }
if (pages.isEmpty()) {
throw Exception(context.localize(MR.strings.page_list_empty_error))
throw Exception(context.stringResource(MR.strings.page_list_empty_error))
}
// If the chapter is partially read, set the starting page to the last the user read
@@ -92,14 +92,14 @@ class ChapterLoader(
is Format.Rar -> try {
RarPageLoader(format.file)
} catch (e: UnsupportedRarV5Exception) {
error(context.localize(MR.strings.loader_rar5_error))
error(context.stringResource(MR.strings.loader_rar5_error))
}
is Format.Epub -> EpubPageLoader(format.file)
}
}
source is HttpSource -> HttpPageLoader(chapter, source)
source is StubSource -> error(context.localize(MR.strings.source_not_installed, source.toString()))
else -> error(context.localize(MR.strings.loader_not_implemented_error))
source is StubSource -> error(context.stringResource(MR.strings.source_not_installed, source.toString()))
else -> error(context.stringResource(MR.strings.loader_not_implemented_error))
}
}
}

View File

@@ -20,7 +20,7 @@ import kotlinx.coroutines.Job
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import tachiyomi.core.i18n.localize
import tachiyomi.core.i18n.stringResource
import tachiyomi.i18n.MR
/**
@@ -105,7 +105,7 @@ class PagerTransitionHolder(
val textView = AppCompatTextView(context).apply {
wrapContent()
text = context.localize(MR.strings.transition_pages_loading)
text = context.stringResource(MR.strings.transition_pages_loading)
}
pagesContainer.addView(progress)
@@ -118,13 +118,13 @@ class PagerTransitionHolder(
private fun setError(error: Throwable) {
val textView = AppCompatTextView(context).apply {
wrapContent()
text = context.localize(MR.strings.transition_pages_error, error.message ?: "")
text = context.stringResource(MR.strings.transition_pages_error, error.message ?: "")
}
val retryBtn = ReaderButton(context).apply {
viewer = this@PagerTransitionHolder.viewer
wrapContent()
text = context.localize(MR.strings.action_retry)
text = context.stringResource(MR.strings.action_retry)
setOnClickListener {
val toChapter = transition.to
if (toChapter != null) {

View File

@@ -17,7 +17,7 @@ import kotlinx.coroutines.Job
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import tachiyomi.core.i18n.localize
import tachiyomi.core.i18n.stringResource
import tachiyomi.i18n.MR
/**
@@ -107,7 +107,7 @@ class WebtoonTransitionHolder(
val textView = AppCompatTextView(context).apply {
wrapContent()
text = context.localize(MR.strings.transition_pages_loading)
text = context.stringResource(MR.strings.transition_pages_loading)
}
pagesContainer.addView(progress)
@@ -120,12 +120,12 @@ class WebtoonTransitionHolder(
private fun setError(error: Throwable, transition: ChapterTransition) {
val textView = AppCompatTextView(context).apply {
wrapContent()
text = context.localize(MR.strings.transition_pages_error, error.message ?: "")
text = context.stringResource(MR.strings.transition_pages_error, error.message ?: "")
}
val retryBtn = AppCompatButton(context).apply {
wrapContent()
text = context.localize(MR.strings.action_retry)
text = context.stringResource(MR.strings.action_retry)
setOnClickListener {
val toChapter = transition.to
if (toChapter != null) {

View File

@@ -8,7 +8,7 @@ import eu.kanade.tachiyomi.ui.base.delegate.SecureActivityDelegate
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.startAuthentication
import logcat.LogPriority
import tachiyomi.core.i18n.localize
import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.system.logcat
import tachiyomi.i18n.MR
@@ -20,7 +20,7 @@ class UnlockActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
startAuthentication(
localize(MR.strings.unlock_app_title, localize(MR.strings.app_name)),
stringResource(MR.strings.unlock_app_title, stringResource(MR.strings.app_name)),
confirmationRequired = false,
callback = object : AuthenticatorUtil.AuthenticationCallback() {
override fun onAuthenticationError(

View File

@@ -12,7 +12,7 @@ import eu.kanade.presentation.more.stats.StatsScreenState
import eu.kanade.presentation.util.Screen
import tachiyomi.i18n.MR
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
class StatsScreen : Screen() {
@@ -27,7 +27,7 @@ class StatsScreen : Screen() {
Scaffold(
topBar = { scrollBehavior ->
AppBar(
title = localize(MR.strings.label_stats),
title = stringResource(MR.strings.label_stats),
navigateUp = navigator::pop,
scrollBehavior = scrollBehavior,
)

View File

@@ -26,9 +26,9 @@ import eu.kanade.tachiyomi.ui.manga.MangaScreen
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
import eu.kanade.tachiyomi.ui.updates.UpdatesScreenModel.Event
import kotlinx.coroutines.flow.collectLatest
import tachiyomi.core.i18n.localize
import tachiyomi.core.i18n.stringResource
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
object UpdatesTab : Tab {
@@ -39,7 +39,7 @@ object UpdatesTab : Tab {
val image = AnimatedImageVector.animatedVectorResource(R.drawable.anim_updates_enter)
return TabOptions(
index = 1u,
title = localize(MR.strings.label_recent_updates),
title = stringResource(MR.strings.label_recent_updates),
icon = rememberAnimatedVectorPainter(image, isSelected),
)
}
@@ -90,7 +90,7 @@ object UpdatesTab : Tab {
screenModel.events.collectLatest { event ->
when (event) {
Event.InternalError -> screenModel.snackbarHostState.showSnackbar(
context.localize(MR.strings.internal_error),
context.stringResource(MR.strings.internal_error),
)
is Event.LibraryUpdateTriggered -> {
val msg = if (event.started) {
@@ -98,7 +98,7 @@ object UpdatesTab : Tab {
} else {
MR.strings.update_already_running
}
screenModel.snackbarHostState.showSnackbar(context.localize(msg))
screenModel.snackbarHostState.showSnackbar(context.stringResource(msg))
}
}
}