From 0d1bced1226878336f8156671ae0c224c02f2604 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 18 Nov 2023 19:41:33 -0500 Subject: [PATCH] Replace remaining Android-specific strings Also renaming the helper composables so it's a bit easier to find/replace everything in forks. --- .../presentation/browse/BrowseSourceScreen.kt | 8 +- .../browse/ExtensionDetailsScreen.kt | 32 ++-- .../browse/ExtensionFilterScreen.kt | 4 +- .../presentation/browse/ExtensionsScreen.kt | 36 ++--- .../browse/MigrateSourceScreen.kt | 14 +- .../browse/SourcesFilterScreen.kt | 4 +- .../presentation/browse/SourcesScreen.kt | 10 +- .../browse/components/BrowseSourceDialogs.kt | 10 +- .../browse/components/BrowseSourceToolbar.kt | 16 +- .../browse/components/GlobalSearchCardRow.kt | 4 +- .../components/GlobalSearchResultItems.kt | 5 +- .../browse/components/GlobalSearchToolbar.kt | 8 +- .../category/CategoryExtensions.kt | 8 +- .../presentation/category/CategoryScreen.kt | 6 +- .../category/components/CategoryDialogs.kt | 52 +++---- .../CategoryFloatingActionButton.kt | 4 +- .../category/components/CategoryListItem.kt | 7 +- .../kanade/presentation/components/AppBar.kt | 21 ++- .../kanade/presentation/components/Banners.kt | 10 +- .../components/DownloadDropdownMenu.kt | 14 +- .../presentation/components/DropdownMenu.kt | 6 +- .../presentation/components/TabbedDialog.kt | 4 +- .../presentation/components/TabbedScreen.kt | 6 +- .../kanade/presentation/crash/CrashScreen.kt | 10 +- .../presentation/history/HistoryScreen.kt | 6 +- .../history/components/HistoryDialogs.kt | 20 +-- .../history/components/HistoryItem.kt | 6 +- .../library/DeleteLibraryMangaDialog.kt | 10 +- .../library/LibrarySettingsDialog.kt | 42 ++--- .../library/components/CommonMangaItem.kt | 4 +- .../library/components/GlobalSearchItem.kt | 4 +- .../library/components/LibraryToolbar.kt | 14 +- .../manga/ChapterSettingsDialog.kt | 34 ++-- .../manga/DuplicateMangaDialog.kt | 12 +- .../kanade/presentation/manga/MangaScreen.kt | 14 +- .../components/ChapterDownloadIndicator.kt | 12 +- .../manga/components/ChapterHeader.kt | 10 +- .../manga/components/MangaBottomActionMenu.kt | 27 ++-- .../manga/components/MangaChapterListItem.kt | 6 +- .../manga/components/MangaCoverDialog.kt | 14 +- .../manga/components/MangaDialogs.kt | 18 +-- .../manga/components/MangaInfoHeader.kt | 46 +++--- .../manga/components/MangaToolbar.kt | 18 +-- .../components/MissingChapterCountListItem.kt | 4 +- .../manga/components/ScanlatorFilterDialog.kt | 16 +- .../eu/kanade/presentation/more/MoreScreen.kt | 34 ++-- .../presentation/more/NewUpdateScreen.kt | 11 +- .../presentation/more/settings/Preference.kt | 4 +- .../more/settings/PreferenceScaffold.kt | 4 +- .../more/settings/screen/Commons.kt | 16 +- .../settings/screen/SettingsAdvancedScreen.kt | 72 ++++----- .../screen/SettingsAppearanceScreen.kt | 42 ++--- .../settings/screen/SettingsBrowseScreen.kt | 18 +-- .../settings/screen/SettingsDataScreen.kt | 68 ++++---- .../settings/screen/SettingsDownloadScreen.kt | 62 ++++---- .../settings/screen/SettingsLibraryScreen.kt | 88 +++++------ .../settings/screen/SettingsMainScreen.kt | 12 +- .../settings/screen/SettingsReaderScreen.kt | 146 +++++++++--------- .../settings/screen/SettingsSearchScreen.kt | 8 +- .../settings/screen/SettingsSecurityScreen.kt | 28 ++-- .../settings/screen/SettingsTrackingScreen.kt | 32 ++-- .../more/settings/screen/about/AboutScreen.kt | 18 +-- .../about/OpenSourceLibraryLicenseScreen.kt | 4 +- .../screen/about/OpenSourceLicensesScreen.kt | 4 +- .../screen/advanced/ClearDatabaseScreen.kt | 20 +-- .../screen/data/CreateBackupScreen.kt | 10 +- .../screen/debug/BackupSchemaScreen.kt | 4 +- .../settings/screen/debug/WorkerInfoScreen.kt | 4 +- .../widget/AppThemePreferenceWidget.kt | 6 +- .../widget/EditTextPreferenceWidget.kt | 6 +- .../more/settings/widget/InfoWidget.kt | 4 +- .../settings/widget/ListPreferenceWidget.kt | 4 +- .../widget/MultiSelectListPreferenceWidget.kt | 6 +- .../widget/TrackingPreferenceWidget.kt | 4 +- .../settings/widget/TriStateListDialog.kt | 8 +- .../more/stats/StatsScreenContent.kt | 30 ++-- .../more/stats/components/StatsSection.kt | 4 +- .../presentation/reader/ChapterTransition.kt | 20 +-- .../reader/OrientationSelectDialog.kt | 4 +- .../reader/ReaderPageActionsDialog.kt | 14 +- .../reader/ReadingModeSelectDialog.kt | 4 +- .../reader/appbars/BottomReaderBar.kt | 10 +- .../reader/appbars/ReaderAppBars.kt | 8 +- .../reader/components/ChapterNavigator.kt | 6 +- .../reader/components/ModeSelectionDialog.kt | 6 +- .../reader/settings/ColorFilterPage.kt | 22 +-- .../reader/settings/GeneralSettingsPage.kt | 20 +-- .../reader/settings/ReaderSettingsDialog.kt | 8 +- .../reader/settings/ReadingModePage.kt | 38 ++--- .../presentation/track/TrackInfoDialogHome.kt | 18 +-- .../track/TrackInfoDialogSelector.kt | 20 +-- .../presentation/track/TrackerSearch.kt | 14 +- .../presentation/updates/UpdatesDialog.kt | 8 +- .../presentation/updates/UpdatesScreen.kt | 10 +- .../presentation/updates/UpdatesUiItem.kt | 10 +- .../presentation/util/ExceptionFormatter.kt | 14 +- .../eu/kanade/presentation/util/TimeUtils.kt | 22 ++- .../webview/WebViewScreenContent.kt | 14 +- app/src/main/java/eu/kanade/tachiyomi/App.kt | 6 +- .../tachiyomi/data/backup/BackupCreator.kt | 8 +- .../data/backup/BackupFileValidator.kt | 4 +- .../tachiyomi/data/backup/BackupNotifier.kt | 26 ++-- .../tachiyomi/data/backup/BackupRestoreJob.kt | 4 +- .../tachiyomi/data/backup/BackupRestorer.kt | 20 +-- .../data/download/DownloadManager.kt | 4 +- .../data/download/DownloadNotifier.kt | 20 +-- .../data/download/DownloadProvider.kt | 4 +- .../data/download/DownloadService.kt | 6 +- .../tachiyomi/data/download/Downloader.kt | 10 +- .../data/library/LibraryUpdateJob.kt | 22 +-- .../data/library/LibraryUpdateNotifier.kt | 46 +++--- .../data/notification/Notifications.kt | 34 ++-- .../kanade/tachiyomi/data/saver/ImageSaver.kt | 10 +- .../data/updater/AppUpdateDownloadJob.kt | 4 +- .../data/updater/AppUpdateNotifier.kt | 28 ++-- .../extension/api/ExtensionUpdateNotifier.kt | 4 +- .../extension/util/ExtensionInstallService.kt | 4 +- .../kanade/tachiyomi/ui/browse/BrowseTab.kt | 4 +- .../browse/extension/ExtensionFilterScreen.kt | 4 +- .../ui/browse/extension/ExtensionsTab.kt | 4 +- .../browse/migration/search/MigrateDialog.kt | 12 +- .../migration/search/SourceSearchScreen.kt | 4 +- .../migration/sources/MigrateSourceTab.kt | 4 +- .../tachiyomi/ui/browse/source/SourcesTab.kt | 8 +- .../source/browse/BrowseSourceScreen.kt | 8 +- .../source/browse/SourceFilterDialog.kt | 6 +- .../tachiyomi/ui/deeplink/DeepLinkScreen.kt | 4 +- .../ui/download/DownloadQueueScreen.kt | 22 +-- .../kanade/tachiyomi/ui/history/HistoryTab.kt | 12 +- .../eu/kanade/tachiyomi/ui/home/HomeScreen.kt | 6 +- .../kanade/tachiyomi/ui/library/LibraryTab.kt | 16 +- .../kanade/tachiyomi/ui/main/MainActivity.kt | 8 +- .../ui/manga/MangaCoverScreenModel.kt | 12 +- .../kanade/tachiyomi/ui/manga/MangaScreen.kt | 4 +- .../tachiyomi/ui/manga/MangaScreenModel.kt | 14 +- .../ui/manga/track/TrackInfoDialog.kt | 30 ++-- .../eu/kanade/tachiyomi/ui/more/MoreTab.kt | 4 +- .../tachiyomi/ui/reader/ReaderActivity.kt | 10 +- .../ui/reader/ReaderNavigationOverlayView.kt | 6 +- .../tachiyomi/ui/reader/SaveImageNotifier.kt | 12 +- .../ui/reader/loader/ChapterLoader.kt | 10 +- .../viewer/pager/PagerTransitionHolder.kt | 8 +- .../viewer/webtoon/WebtoonTransitionHolder.kt | 8 +- .../tachiyomi/ui/security/UnlockActivity.kt | 4 +- .../kanade/tachiyomi/ui/stats/StatsScreen.kt | 4 +- .../kanade/tachiyomi/ui/updates/UpdatesTab.kt | 10 +- .../tachiyomi/util/lang/DateExtensions.kt | 8 +- .../util/system/AuthenticatorUtil.kt | 4 +- .../util/system/ContextExtensions.kt | 4 +- .../tachiyomi/util/system/IntentExtensions.kt | 4 +- .../tachiyomi/util/system/LocaleHelper.kt | 10 +- .../interceptor/CloudflareInterceptor.kt | 4 +- .../tachiyomi/util/system/ToastExtensions.kt | 4 +- .../main/java/tachiyomi/core/i18n/Localize.kt | 8 +- .../provider/AndroidBackupFolderProvider.kt | 4 +- .../provider/AndroidDownloadFolderProvider.kt | 4 +- .../commonMain/resources/MR/base/strings.xml | 7 +- .../core/components/SettingsItems.kt | 4 +- .../presentation/core/i18n/Localize.kt | 20 +-- .../presentation/core/screens/EmptyScreen.kt | 6 +- .../widget/components/LockedWidget.kt | 4 +- .../widget/components/UpdatesWidget.kt | 4 +- .../tachiyomi/source/local/LocalSource.kt | 8 +- .../tachiyomi/source/local/filter/OrderBy.kt | 6 +- .../source/local/io/LocalSourceFileSystem.kt | 4 +- 165 files changed, 1179 insertions(+), 1167 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt index 2b9d2d9633..95003f1e49 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt @@ -24,13 +24,13 @@ import eu.kanade.presentation.util.formattedMessage import eu.kanade.tachiyomi.source.Source import kotlinx.collections.immutable.persistentListOf import kotlinx.coroutines.flow.StateFlow -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.domain.library.model.LibraryDisplayMode import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.source.model.StubSource 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 @@ -63,7 +63,7 @@ fun BrowseSourceContent( if (mangaList.itemCount > 0 && errorState != null && errorState is LoadState.Error) { val result = snackbarHostState.showSnackbar( message = getErrorMessage(errorState), - actionLabel = context.localize(MR.strings.action_retry), + actionLabel = context.stringResource(MR.strings.action_retry), duration = SnackbarDuration.Indefinite, ) when (result) { @@ -161,7 +161,7 @@ internal fun MissingSourceScreen( }, ) { paddingValues -> EmptyScreen( - message = localize(MR.strings.source_not_installed, source.toString()), + message = stringResource(MR.strings.source_not_installed, source.toString()), modifier = Modifier.padding(paddingValues), ) } diff --git a/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt index 0a34ad0a78..abb8935727 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt @@ -58,7 +58,7 @@ import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.ScrollbarLazyColumn 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.presentation.core.screens.EmptyScreen @Composable @@ -77,7 +77,7 @@ fun ExtensionDetailsScreen( Scaffold( topBar = { scrollBehavior -> AppBar( - title = localize(MR.strings.label_extension_info), + title = stringResource(MR.strings.label_extension_info), navigateUp = navigateUp, actions = { AppBarActions( @@ -86,14 +86,14 @@ fun ExtensionDetailsScreen( if (state.extension?.isUnofficial == false) { add( AppBar.Action( - title = localize(MR.strings.whats_new), + title = stringResource(MR.strings.whats_new), icon = Icons.Outlined.History, onClick = onClickWhatsNew, ), ) add( AppBar.Action( - title = localize(MR.strings.action_faq_and_guides), + title = stringResource(MR.strings.action_faq_and_guides), icon = Icons.AutoMirrored.Outlined.HelpOutline, onClick = onClickReadme, ), @@ -102,15 +102,15 @@ fun ExtensionDetailsScreen( addAll( listOf( AppBar.OverflowAction( - title = localize(MR.strings.action_enable_all), + title = stringResource(MR.strings.action_enable_all), onClick = onClickEnableAll, ), AppBar.OverflowAction( - title = localize(MR.strings.action_disable_all), + title = stringResource(MR.strings.action_disable_all), onClick = onClickDisableAll, ), AppBar.OverflowAction( - title = localize(MR.strings.pref_clear_cookies), + title = stringResource(MR.strings.pref_clear_cookies), onClick = onClickClearCookies, ), ), @@ -260,7 +260,7 @@ private fun DetailsHeader( InfoText( modifier = Modifier.weight(1f), primaryText = extension.versionName, - secondaryText = localize(MR.strings.ext_info_version), + secondaryText = stringResource(MR.strings.ext_info_version), ) InfoDivider() @@ -268,7 +268,7 @@ private fun DetailsHeader( InfoText( modifier = Modifier.weight(if (extension.isNsfw) 1.5f else 1f), primaryText = LocaleHelper.getSourceDisplayName(extension.lang, context), - secondaryText = localize(MR.strings.ext_info_language), + secondaryText = stringResource(MR.strings.ext_info_language), ) if (extension.isNsfw) { @@ -276,12 +276,12 @@ private fun DetailsHeader( InfoText( modifier = Modifier.weight(1f), - primaryText = localize(MR.strings.ext_nsfw_short), + primaryText = stringResource(MR.strings.ext_nsfw_short), primaryTextStyle = MaterialTheme.typography.bodyLarge.copy( color = MaterialTheme.colorScheme.error, fontWeight = FontWeight.Medium, ), - secondaryText = localize(MR.strings.ext_info_age_rating), + secondaryText = stringResource(MR.strings.ext_info_age_rating), onClick = onClickAgeRating, ) } @@ -300,7 +300,7 @@ private fun DetailsHeader( modifier = Modifier.weight(1f), onClick = onClickUninstall, ) { - Text(localize(MR.strings.ext_uninstall)) + Text(stringResource(MR.strings.ext_uninstall)) } if (onClickAppInfo != null) { @@ -309,7 +309,7 @@ private fun DetailsHeader( onClick = onClickAppInfo, ) { Text( - text = localize(MR.strings.ext_app_info), + text = stringResource(MR.strings.ext_app_info), color = MaterialTheme.colorScheme.onPrimary, ) } @@ -387,7 +387,7 @@ private fun SourceSwitchPreference( IconButton(onClick = { onClickSourcePreferences(source.source.id) }) { Icon( imageVector = Icons.Outlined.Settings, - contentDescription = localize(MR.strings.label_settings), + contentDescription = stringResource(MR.strings.label_settings), tint = MaterialTheme.colorScheme.onSurface, ) } @@ -410,11 +410,11 @@ private fun NsfwWarningDialog( ) { AlertDialog( text = { - Text(text = localize(MR.strings.ext_nsfw_warning)) + Text(text = stringResource(MR.strings.ext_nsfw_warning)) }, confirmButton = { TextButton(onClick = onClickConfirm) { - Text(text = localize(MR.strings.action_ok)) + Text(text = stringResource(MR.strings.action_ok)) } }, onDismissRequest = onClickConfirm, diff --git a/app/src/main/java/eu/kanade/presentation/browse/ExtensionFilterScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/ExtensionFilterScreen.kt index 1178e1e857..51acdfccff 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/ExtensionFilterScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/ExtensionFilterScreen.kt @@ -13,7 +13,7 @@ import eu.kanade.tachiyomi.ui.browse.extension.ExtensionFilterState import eu.kanade.tachiyomi.util.system.LocaleHelper 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 @Composable @@ -25,7 +25,7 @@ fun ExtensionFilterScreen( Scaffold( topBar = { scrollBehavior -> AppBar( - title = localize(MR.strings.label_extensions), + title = stringResource(MR.strings.label_extensions), navigateUp = navigateUp, scrollBehavior = scrollBehavior, ) diff --git a/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt index adde67c29b..c914d8e81b 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt @@ -48,7 +48,7 @@ import tachiyomi.presentation.core.components.FastScrollLazyColumn import tachiyomi.presentation.core.components.material.PullRefresh import tachiyomi.presentation.core.components.material.padding 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.LoadingScreen import tachiyomi.presentation.core.theme.header @@ -136,7 +136,7 @@ private fun ExtensionContent( { Button(onClick = { onClickUpdateAll() }) { Text( - text = localize(MR.strings.ext_update_all), + text = stringResource(MR.strings.ext_update_all), style = LocalTextStyle.current.copy( color = MaterialTheme.colorScheme.onPrimary, ), @@ -312,7 +312,7 @@ private fun ExtensionItemContent( } if (warning != null) { Text( - text = localize(warning).uppercase(), + text = stringResource(warning).uppercase(), color = MaterialTheme.colorScheme.error, maxLines = 1, overflow = TextOverflow.Ellipsis, @@ -323,9 +323,9 @@ private fun ExtensionItemContent( DotSeparatorNoSpaceText() Text( text = when (installStep) { - InstallStep.Pending -> localize(MR.strings.ext_pending) - InstallStep.Downloading -> localize(MR.strings.ext_downloading) - InstallStep.Installing -> localize(MR.strings.ext_installing) + InstallStep.Pending -> stringResource(MR.strings.ext_pending) + InstallStep.Downloading -> stringResource(MR.strings.ext_downloading) + InstallStep.Installing -> stringResource(MR.strings.ext_installing) else -> error("Must not show non-install process text") }, ) @@ -351,19 +351,19 @@ private fun ExtensionItemActions( ) { Text( text = when (installStep) { - InstallStep.Installed -> localize(MR.strings.ext_installed) - InstallStep.Error -> localize(MR.strings.action_retry) + InstallStep.Installed -> stringResource(MR.strings.ext_installed) + InstallStep.Error -> stringResource(MR.strings.action_retry) InstallStep.Idle -> { when (extension) { is Extension.Installed -> { if (extension.hasUpdate) { - localize(MR.strings.ext_update) + stringResource(MR.strings.ext_update) } else { - localize(MR.strings.action_settings) + stringResource(MR.strings.action_settings) } } - is Extension.Untrusted -> localize(MR.strings.ext_trust) - is Extension.Available -> localize(MR.strings.ext_install) + is Extension.Untrusted -> stringResource(MR.strings.ext_trust) + is Extension.Available -> stringResource(MR.strings.ext_install) } } else -> error("Must not show install process text") @@ -374,7 +374,7 @@ private fun ExtensionItemActions( IconButton(onClick = { onClickItemCancel(extension) }) { Icon( imageVector = Icons.Outlined.Close, - contentDescription = localize(MR.strings.action_cancel), + contentDescription = stringResource(MR.strings.action_cancel), ) } } @@ -388,7 +388,7 @@ private fun ExtensionHeader( action: @Composable RowScope.() -> Unit = {}, ) { ExtensionHeader( - text = localize(textRes), + text = stringResource(textRes), modifier = modifier, action = action, ) @@ -423,19 +423,19 @@ private fun ExtensionTrustDialog( ) { AlertDialog( title = { - Text(text = localize(MR.strings.untrusted_extension)) + Text(text = stringResource(MR.strings.untrusted_extension)) }, text = { - Text(text = localize(MR.strings.untrusted_extension_message)) + Text(text = stringResource(MR.strings.untrusted_extension_message)) }, confirmButton = { TextButton(onClick = onClickConfirm) { - Text(text = localize(MR.strings.ext_trust)) + Text(text = stringResource(MR.strings.ext_trust)) } }, dismissButton = { TextButton(onClick = onClickDismiss) { - Text(text = localize(MR.strings.ext_uninstall)) + Text(text = stringResource(MR.strings.ext_uninstall)) } }, onDismissRequest = onDismissRequest, diff --git a/app/src/main/java/eu/kanade/presentation/browse/MigrateSourceScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/MigrateSourceScreen.kt index c208fc7928..b7dc70ebb7 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/MigrateSourceScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/MigrateSourceScreen.kt @@ -34,7 +34,7 @@ import tachiyomi.presentation.core.components.ScrollbarLazyColumn import tachiyomi.presentation.core.components.Scroller.STICKY_HEADER_KEY_PREFIX import tachiyomi.presentation.core.components.material.padding 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.LoadingScreen import tachiyomi.presentation.core.theme.header @@ -95,7 +95,7 @@ private fun MigrateSourceList( verticalAlignment = Alignment.CenterVertically, ) { Text( - text = localize(MR.strings.migration_selection_prompt), + text = stringResource(MR.strings.migration_selection_prompt), modifier = Modifier.weight(1f), style = MaterialTheme.typography.header, ) @@ -104,11 +104,11 @@ private fun MigrateSourceList( when (sortingMode) { SetMigrateSorting.Mode.ALPHABETICAL -> Icon( Icons.Outlined.SortByAlpha, - contentDescription = localize(MR.strings.action_sort_alpha), + contentDescription = stringResource(MR.strings.action_sort_alpha), ) SetMigrateSorting.Mode.TOTAL -> Icon( Icons.Outlined.Numbers, - contentDescription = localize(MR.strings.action_sort_count), + contentDescription = stringResource(MR.strings.action_sort_count), ) } } @@ -116,11 +116,11 @@ private fun MigrateSourceList( when (sortingDirection) { SetMigrateSorting.Direction.ASCENDING -> Icon( Icons.Outlined.ArrowUpward, - contentDescription = localize(MR.strings.action_asc), + contentDescription = stringResource(MR.strings.action_asc), ) SetMigrateSorting.Direction.DESCENDING -> Icon( Icons.Outlined.ArrowDownward, - contentDescription = localize(MR.strings.action_desc), + contentDescription = stringResource(MR.strings.action_desc), ) } } @@ -189,7 +189,7 @@ private fun MigrateSourceItem( if (source.isStub) { Text( modifier = Modifier.secondaryItemAlpha(), - text = localize(MR.strings.not_installed), + text = stringResource(MR.strings.not_installed), maxLines = 1, overflow = TextOverflow.Ellipsis, style = MaterialTheme.typography.bodySmall, diff --git a/app/src/main/java/eu/kanade/presentation/browse/SourcesFilterScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/SourcesFilterScreen.kt index 362a902cfb..6306800b80 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/SourcesFilterScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/SourcesFilterScreen.kt @@ -16,7 +16,7 @@ import tachiyomi.domain.source.model.Source import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.FastScrollLazyColumn 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 @Composable @@ -29,7 +29,7 @@ fun SourcesFilterScreen( Scaffold( topBar = { scrollBehavior -> AppBar( - title = localize(MR.strings.label_sources), + title = stringResource(MR.strings.label_sources), navigateUp = navigateUp, scrollBehavior = scrollBehavior, ) diff --git a/app/src/main/java/eu/kanade/presentation/browse/SourcesScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/SourcesScreen.kt index a84f6b6ebc..94cca357d4 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/SourcesScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/SourcesScreen.kt @@ -31,7 +31,7 @@ import tachiyomi.presentation.core.components.ScrollbarLazyColumn import tachiyomi.presentation.core.components.material.SecondaryItemAlpha import tachiyomi.presentation.core.components.material.padding 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.LoadingScreen import tachiyomi.presentation.core.theme.header @@ -121,7 +121,7 @@ private fun SourceItem( if (source.supportsLatest) { TextButton(onClick = { onClickItem(source, Listing.Latest) }) { Text( - text = localize(MR.strings.latest), + text = stringResource(MR.strings.latest), style = LocalTextStyle.current.copy( color = MaterialTheme.colorScheme.primary, ), @@ -154,7 +154,7 @@ private fun SourcePinButton( Icon( imageVector = icon, tint = tint, - contentDescription = localize(description), + contentDescription = stringResource(description), ) } } @@ -174,7 +174,7 @@ fun SourceOptionsDialog( Column { val textId = if (Pin.Pinned in source.pin) MR.strings.action_unpin else MR.strings.action_pin Text( - text = localize(textId), + text = stringResource(textId), modifier = Modifier .clickable(onClick = onClickPin) .fillMaxWidth() @@ -182,7 +182,7 @@ fun SourceOptionsDialog( ) if (!source.isLocal()) { Text( - text = localize(MR.strings.action_disable), + text = stringResource(MR.strings.action_disable), modifier = Modifier .clickable(onClick = onClickDisable) .fillMaxWidth() diff --git a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceDialogs.kt b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceDialogs.kt index 97e02abf17..64955de744 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceDialogs.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceDialogs.kt @@ -6,7 +6,7 @@ import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable import tachiyomi.domain.manga.model.Manga import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun RemoveMangaDialog( @@ -18,7 +18,7 @@ fun RemoveMangaDialog( onDismissRequest = onDismissRequest, dismissButton = { TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } }, confirmButton = { @@ -28,14 +28,14 @@ fun RemoveMangaDialog( onConfirm() }, ) { - Text(text = localize(MR.strings.action_remove)) + Text(text = stringResource(MR.strings.action_remove)) } }, title = { - Text(text = localize(MR.strings.are_you_sure)) + Text(text = stringResource(MR.strings.are_you_sure)) }, text = { - Text(text = localize(MR.strings.remove_manga, mangaToRemove.title)) + Text(text = stringResource(MR.strings.remove_manga, mangaToRemove.title)) }, ) } diff --git a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceToolbar.kt b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceToolbar.kt index 62f5fb24e6..e1c3618eea 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceToolbar.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceToolbar.kt @@ -21,7 +21,7 @@ import eu.kanade.tachiyomi.source.Source import kotlinx.collections.immutable.persistentListOf import tachiyomi.domain.library.model.LibraryDisplayMode import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.source.local.LocalSource @Composable @@ -58,7 +58,7 @@ fun BrowseSourceToolbar( .apply { add( AppBar.Action( - title = localize(MR.strings.action_display_mode), + title = stringResource(MR.strings.action_display_mode), icon = if (displayMode == LibraryDisplayMode.List) { Icons.AutoMirrored.Filled.ViewList } else { @@ -70,14 +70,14 @@ fun BrowseSourceToolbar( if (isLocalSource) { add( AppBar.OverflowAction( - title = localize(MR.strings.label_help), + title = stringResource(MR.strings.label_help), onClick = onHelpClick, ), ) } else { add( AppBar.OverflowAction( - title = localize(MR.strings.action_open_in_web_view), + title = stringResource(MR.strings.action_open_in_web_view), onClick = onWebViewClick, ), ) @@ -85,7 +85,7 @@ fun BrowseSourceToolbar( if (isConfigurableSource) { add( AppBar.OverflowAction( - title = localize(MR.strings.action_settings), + title = stringResource(MR.strings.action_settings), onClick = onSettingsClick, ), ) @@ -99,21 +99,21 @@ fun BrowseSourceToolbar( onDismissRequest = { selectingDisplayMode = false }, ) { RadioMenuItem( - text = { Text(text = localize(MR.strings.action_display_comfortable_grid)) }, + text = { Text(text = stringResource(MR.strings.action_display_comfortable_grid)) }, isChecked = displayMode == LibraryDisplayMode.ComfortableGrid, ) { selectingDisplayMode = false onDisplayModeChange(LibraryDisplayMode.ComfortableGrid) } RadioMenuItem( - text = { Text(text = localize(MR.strings.action_display_grid)) }, + text = { Text(text = stringResource(MR.strings.action_display_grid)) }, isChecked = displayMode == LibraryDisplayMode.CompactGrid, ) { selectingDisplayMode = false onDisplayModeChange(LibraryDisplayMode.CompactGrid) } RadioMenuItem( - text = { Text(text = localize(MR.strings.action_display_list)) }, + text = { Text(text = stringResource(MR.strings.action_display_list)) }, isChecked = displayMode == LibraryDisplayMode.List, ) { selectingDisplayMode = false diff --git a/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchCardRow.kt b/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchCardRow.kt index 5d35fdebd2..135b1135e6 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchCardRow.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchCardRow.kt @@ -21,7 +21,7 @@ import tachiyomi.domain.manga.model.MangaCover import tachiyomi.domain.manga.model.asMangaCover import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.padding -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun GlobalSearchCardRow( @@ -78,7 +78,7 @@ private fun MangaItem( @Composable private fun EmptyResultItem() { Text( - text = localize(MR.strings.no_results_found), + text = stringResource(MR.strings.no_results_found), modifier = Modifier .padding( horizontal = MaterialTheme.padding.medium, diff --git a/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchResultItems.kt b/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchResultItems.kt index 11486a7e79..d0f032a2d8 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchResultItems.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchResultItems.kt @@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.material.icons.Icons 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.material3.CircularProgressIndicator import androidx.compose.material3.Icon @@ -26,7 +25,7 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.padding -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun GlobalSearchResultItem( @@ -93,7 +92,7 @@ fun GlobalSearchErrorResultItem(message: String?) { Icon(imageVector = Icons.Outlined.Error, contentDescription = null) Spacer(Modifier.height(4.dp)) Text( - text = message ?: localize(MR.strings.unknown_error), + text = message ?: stringResource(MR.strings.unknown_error), textAlign = TextAlign.Center, ) } diff --git a/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchToolbar.kt b/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchToolbar.kt index e439e7da61..fa61696ae7 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchToolbar.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchToolbar.kt @@ -30,7 +30,7 @@ import eu.kanade.presentation.components.SearchToolbar import eu.kanade.tachiyomi.ui.browse.source.globalsearch.SourceFilter import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.padding -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun GlobalSearchToolbar( @@ -85,7 +85,7 @@ fun GlobalSearchToolbar( ) }, label = { - Text(text = localize(MR.strings.pinned_sources)) + Text(text = stringResource(MR.strings.pinned_sources)) }, ) FilterChip( @@ -100,7 +100,7 @@ fun GlobalSearchToolbar( ) }, label = { - Text(text = localize(MR.strings.all)) + Text(text = stringResource(MR.strings.all)) }, ) @@ -118,7 +118,7 @@ fun GlobalSearchToolbar( ) }, label = { - Text(text = localize(MR.strings.has_results)) + Text(text = stringResource(MR.strings.has_results)) }, ) } diff --git a/app/src/main/java/eu/kanade/presentation/category/CategoryExtensions.kt b/app/src/main/java/eu/kanade/presentation/category/CategoryExtensions.kt index ce0f071c46..a6c22c2409 100644 --- a/app/src/main/java/eu/kanade/presentation/category/CategoryExtensions.kt +++ b/app/src/main/java/eu/kanade/presentation/category/CategoryExtensions.kt @@ -2,20 +2,20 @@ package eu.kanade.presentation.category import android.content.Context import androidx.compose.runtime.Composable -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.domain.category.model.Category import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource val Category.visualName: String @Composable get() = when { - isSystemCategory -> localize(MR.strings.label_default) + isSystemCategory -> stringResource(MR.strings.label_default) else -> name } fun Category.visualName(context: Context): String = when { - isSystemCategory -> context.localize(MR.strings.label_default) + isSystemCategory -> context.stringResource(MR.strings.label_default) else -> name } diff --git a/app/src/main/java/eu/kanade/presentation/category/CategoryScreen.kt b/app/src/main/java/eu/kanade/presentation/category/CategoryScreen.kt index 831436e8d1..471ec7fc91 100644 --- a/app/src/main/java/eu/kanade/presentation/category/CategoryScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/category/CategoryScreen.kt @@ -23,7 +23,7 @@ import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.padding 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.util.plus @@ -42,13 +42,13 @@ fun CategoryScreen( Scaffold( topBar = { scrollBehavior -> AppBar( - title = localize(MR.strings.action_edit_categories), + title = stringResource(MR.strings.action_edit_categories), navigateUp = navigateUp, actions = { AppBarActions( persistentListOf( AppBar.Action( - title = localize(MR.strings.action_sort), + title = stringResource(MR.strings.action_sort), icon = Icons.Outlined.SortByAlpha, onClick = onClickSortAlphabetically, ), diff --git a/app/src/main/java/eu/kanade/presentation/category/components/CategoryDialogs.kt b/app/src/main/java/eu/kanade/presentation/category/components/CategoryDialogs.kt index 1958e6e597..0441d014a2 100644 --- a/app/src/main/java/eu/kanade/presentation/category/components/CategoryDialogs.kt +++ b/app/src/main/java/eu/kanade/presentation/category/components/CategoryDialogs.kt @@ -32,7 +32,7 @@ import tachiyomi.core.preference.CheckboxState import tachiyomi.domain.category.model.Category import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.padding -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import kotlin.time.Duration.Companion.seconds @Composable @@ -56,30 +56,30 @@ fun CategoryCreateDialog( onDismissRequest() }, ) { - Text(text = localize(MR.strings.action_add)) + Text(text = stringResource(MR.strings.action_add)) } }, dismissButton = { TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } }, title = { - Text(text = localize(MR.strings.action_add_category)) + Text(text = stringResource(MR.strings.action_add_category)) }, text = { OutlinedTextField( modifier = Modifier.focusRequester(focusRequester), value = name, onValueChange = { name = it }, - label = { Text(text = localize(MR.strings.name)) }, + label = { Text(text = stringResource(MR.strings.name)) }, supportingText = { val msgRes = if (name.isNotEmpty() && nameAlreadyExists) { MR.strings.error_category_exists } else { MR.strings.information_required_plain } - Text(text = localize(msgRes)) + Text(text = stringResource(msgRes)) }, isError = name.isNotEmpty() && nameAlreadyExists, singleLine = true, @@ -117,16 +117,16 @@ fun CategoryRenameDialog( onDismissRequest() }, ) { - Text(text = localize(MR.strings.action_ok)) + Text(text = stringResource(MR.strings.action_ok)) } }, dismissButton = { TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } }, title = { - Text(text = localize(MR.strings.action_rename_category)) + Text(text = stringResource(MR.strings.action_rename_category)) }, text = { OutlinedTextField( @@ -136,14 +136,14 @@ fun CategoryRenameDialog( valueHasChanged = name != it name = it }, - label = { Text(text = localize(MR.strings.name)) }, + label = { Text(text = stringResource(MR.strings.name)) }, supportingText = { val msgRes = if (valueHasChanged && nameAlreadyExists) { MR.strings.error_category_exists } else { MR.strings.information_required_plain } - Text(text = localize(msgRes)) + Text(text = stringResource(msgRes)) }, isError = valueHasChanged && nameAlreadyExists, singleLine = true, @@ -171,19 +171,19 @@ fun CategoryDeleteDialog( onDelete() onDismissRequest() }) { - Text(text = localize(MR.strings.action_ok)) + Text(text = stringResource(MR.strings.action_ok)) } }, dismissButton = { TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } }, title = { - Text(text = localize(MR.strings.delete_category)) + Text(text = stringResource(MR.strings.delete_category)) }, text = { - Text(text = localize(MR.strings.delete_category_confirmation, category.name)) + Text(text = stringResource(MR.strings.delete_category_confirmation, category.name)) }, ) } @@ -200,19 +200,19 @@ fun CategorySortAlphabeticallyDialog( onSort() onDismissRequest() }) { - Text(text = localize(MR.strings.action_ok)) + Text(text = stringResource(MR.strings.action_ok)) } }, dismissButton = { TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } }, title = { - Text(text = localize(MR.strings.action_sort_category)) + Text(text = stringResource(MR.strings.action_sort_category)) }, text = { - Text(text = localize(MR.strings.sort_category_confirmation)) + Text(text = stringResource(MR.strings.sort_category_confirmation)) }, ) } @@ -234,14 +234,14 @@ fun ChangeCategoryDialog( onEditCategories() }, ) { - Text(text = localize(MR.strings.action_edit_categories)) + Text(text = stringResource(MR.strings.action_edit_categories)) } }, title = { - Text(text = localize(MR.strings.action_move_category)) + Text(text = stringResource(MR.strings.action_move_category)) }, text = { - Text(text = localize(MR.strings.information_empty_category_dialog)) + Text(text = stringResource(MR.strings.information_empty_category_dialog)) }, ) return @@ -255,11 +255,11 @@ fun ChangeCategoryDialog( onDismissRequest() onEditCategories() }) { - Text(text = localize(MR.strings.action_edit)) + Text(text = stringResource(MR.strings.action_edit)) } Spacer(modifier = Modifier.weight(1f)) tachiyomi.presentation.core.components.material.TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } tachiyomi.presentation.core.components.material.TextButton( onClick = { @@ -274,12 +274,12 @@ fun ChangeCategoryDialog( ) }, ) { - Text(text = localize(MR.strings.action_ok)) + Text(text = stringResource(MR.strings.action_ok)) } } }, title = { - Text(text = localize(MR.strings.action_move_category)) + Text(text = stringResource(MR.strings.action_move_category)) }, text = { Column( diff --git a/app/src/main/java/eu/kanade/presentation/category/components/CategoryFloatingActionButton.kt b/app/src/main/java/eu/kanade/presentation/category/components/CategoryFloatingActionButton.kt index bbb17095c6..2aaf81efd7 100644 --- a/app/src/main/java/eu/kanade/presentation/category/components/CategoryFloatingActionButton.kt +++ b/app/src/main/java/eu/kanade/presentation/category/components/CategoryFloatingActionButton.kt @@ -8,7 +8,7 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import tachiyomi.i18n.MR 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.isScrollingUp @@ -18,7 +18,7 @@ fun CategoryFloatingActionButton( onCreate: () -> Unit, ) { 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) }, onClick = onCreate, expanded = lazyListState.isScrollingUp() || lazyListState.isScrolledToEnd(), diff --git a/app/src/main/java/eu/kanade/presentation/category/components/CategoryListItem.kt b/app/src/main/java/eu/kanade/presentation/category/components/CategoryListItem.kt index 07b4c4fba2..e2d5c4261d 100644 --- a/app/src/main/java/eu/kanade/presentation/category/components/CategoryListItem.kt +++ b/app/src/main/java/eu/kanade/presentation/category/components/CategoryListItem.kt @@ -11,7 +11,6 @@ import androidx.compose.material.icons.outlined.ArrowDropDown import androidx.compose.material.icons.outlined.ArrowDropUp import androidx.compose.material.icons.outlined.Delete import androidx.compose.material.icons.outlined.Edit -import androidx.compose.material.icons.outlined.Label import androidx.compose.material3.ElevatedCard import androidx.compose.material3.Icon import androidx.compose.material3.IconButton @@ -23,7 +22,7 @@ import androidx.compose.ui.Modifier import tachiyomi.domain.category.model.Category import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.padding -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun CategoryListItem( @@ -74,11 +73,11 @@ fun CategoryListItem( IconButton(onClick = onRename) { Icon( imageVector = Icons.Outlined.Edit, - contentDescription = localize(MR.strings.action_rename_category), + contentDescription = stringResource(MR.strings.action_rename_category), ) } 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)) } } } diff --git a/app/src/main/java/eu/kanade/presentation/components/AppBar.kt b/app/src/main/java/eu/kanade/presentation/components/AppBar.kt index be162175b1..0bfd039eb2 100644 --- a/app/src/main/java/eu/kanade/presentation/components/AppBar.kt +++ b/app/src/main/java/eu/kanade/presentation/components/AppBar.kt @@ -50,10 +50,9 @@ import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import eu.kanade.tachiyomi.R import kotlinx.collections.immutable.ImmutableList 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.runOnEnterKeyPressed import tachiyomi.presentation.core.util.secondaryItemAlpha @@ -135,7 +134,7 @@ fun AppBar( IconButton(onClick = onCancelActionMode) { Icon( imageVector = Icons.Outlined.Close, - contentDescription = localize(MR.strings.action_cancel), + contentDescription = stringResource(MR.strings.action_cancel), ) } } else { @@ -220,7 +219,7 @@ fun AppBarActions( positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(), tooltip = { PlainTooltip { - Text(stringResource(R.string.abc_action_menu_overflow_description)) + Text(stringResource(MR.strings.action_menu_overflow_description)) } }, state = rememberTooltipState(), @@ -230,7 +229,7 @@ fun AppBarActions( ) { Icon( 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 = { Text( modifier = Modifier.secondaryItemAlpha(), - text = (placeholderText ?: localize(MR.strings.action_search_hint)), + text = (placeholderText ?: stringResource(MR.strings.action_search_hint)), maxLines = 1, overflow = TextOverflow.Ellipsis, style = MaterialTheme.typography.titleMedium.copy( @@ -344,7 +343,7 @@ fun SearchToolbar( positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(), tooltip = { PlainTooltip { - Text(localize(MR.strings.action_search)) + Text(stringResource(MR.strings.action_search)) } }, state = rememberTooltipState(), @@ -354,7 +353,7 @@ fun SearchToolbar( ) { Icon( Icons.Outlined.Search, - contentDescription = localize(MR.strings.action_search), + contentDescription = stringResource(MR.strings.action_search), ) } } @@ -363,7 +362,7 @@ fun SearchToolbar( positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(), tooltip = { PlainTooltip { - Text(localize(MR.strings.action_reset)) + Text(stringResource(MR.strings.action_reset)) } }, state = rememberTooltipState(), @@ -376,7 +375,7 @@ fun SearchToolbar( ) { Icon( 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 Icon( imageVector = icon, - contentDescription = stringResource(R.string.abc_action_bar_up_description), + contentDescription = stringResource(MR.strings.action_bar_up_description), ) } diff --git a/app/src/main/java/eu/kanade/presentation/components/Banners.kt b/app/src/main/java/eu/kanade/presentation/components/Banners.kt index 070cc9a696..7e702a8109 100644 --- a/app/src/main/java/eu/kanade/presentation/components/Banners.kt +++ b/app/src/main/java/eu/kanade/presentation/components/Banners.kt @@ -32,7 +32,7 @@ import androidx.compose.ui.util.fastMap import androidx.compose.ui.util.fastMaxBy import dev.icerock.moko.resources.StringResource import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource val DownloadedOnlyBannerBackgroundColor @Composable get() = MaterialTheme.colorScheme.tertiary @@ -47,7 +47,7 @@ fun WarningBanner( modifier: Modifier = Modifier, ) { Text( - text = localize(textRes), + text = stringResource(textRes), modifier = modifier .fillMaxWidth() .background(MaterialTheme.colorScheme.error) @@ -127,7 +127,7 @@ fun AppStateBanners( @Composable private fun DownloadedOnlyModeBanner(modifier: Modifier = Modifier) { Text( - text = localize(MR.strings.label_downloaded_only), + text = stringResource(MR.strings.label_downloaded_only), modifier = Modifier .background(DownloadedOnlyBannerBackgroundColor) .fillMaxWidth() @@ -142,7 +142,7 @@ private fun DownloadedOnlyModeBanner(modifier: Modifier = Modifier) { @Composable private fun IncognitoModeBanner(modifier: Modifier = Modifier) { Text( - text = localize(MR.strings.pref_incognito_mode), + text = stringResource(MR.strings.pref_incognito_mode), modifier = Modifier .background(IncognitoModeBannerBackgroundColor) .fillMaxWidth() @@ -173,7 +173,7 @@ private fun IndexingDownloadBanner(modifier: Modifier = Modifier) { ) Spacer(modifier = Modifier.width(8.dp)) Text( - text = localize(MR.strings.download_notifier_cache_renewal), + text = stringResource(MR.strings.download_notifier_cache_renewal), color = MaterialTheme.colorScheme.onSecondary, textAlign = TextAlign.Center, style = MaterialTheme.typography.labelMedium, diff --git a/app/src/main/java/eu/kanade/presentation/components/DownloadDropdownMenu.kt b/app/src/main/java/eu/kanade/presentation/components/DownloadDropdownMenu.kt index 8eb83b9f43..36449f13cc 100644 --- a/app/src/main/java/eu/kanade/presentation/components/DownloadDropdownMenu.kt +++ b/app/src/main/java/eu/kanade/presentation/components/DownloadDropdownMenu.kt @@ -5,8 +5,8 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import eu.kanade.presentation.manga.DownloadAction import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize -import tachiyomi.presentation.core.i18n.localizePlural +import tachiyomi.presentation.core.i18n.pluralStringResource +import tachiyomi.presentation.core.i18n.stringResource @Composable fun DownloadDropdownMenu( @@ -19,11 +19,11 @@ fun DownloadDropdownMenu( onDismissRequest = onDismissRequest, ) { listOfNotNull( - DownloadAction.NEXT_1_CHAPTER to localizePlural(MR.plurals.download_amount, 1, 1), - DownloadAction.NEXT_5_CHAPTERS to localizePlural(MR.plurals.download_amount, 5, 5), - DownloadAction.NEXT_10_CHAPTERS to localizePlural(MR.plurals.download_amount, 10, 10), - DownloadAction.NEXT_25_CHAPTERS to localizePlural(MR.plurals.download_amount, 25, 25), - DownloadAction.UNREAD_CHAPTERS to localize(MR.strings.download_unread), + DownloadAction.NEXT_1_CHAPTER to pluralStringResource(MR.plurals.download_amount, 1, 1), + DownloadAction.NEXT_5_CHAPTERS to pluralStringResource(MR.plurals.download_amount, 5, 5), + DownloadAction.NEXT_10_CHAPTERS to pluralStringResource(MR.plurals.download_amount, 10, 10), + DownloadAction.NEXT_25_CHAPTERS to pluralStringResource(MR.plurals.download_amount, 25, 25), + DownloadAction.UNREAD_CHAPTERS to stringResource(MR.strings.download_unread), ).map { (downloadAction, string) -> DropdownMenuItem( text = { Text(text = string) }, diff --git a/app/src/main/java/eu/kanade/presentation/components/DropdownMenu.kt b/app/src/main/java/eu/kanade/presentation/components/DropdownMenu.kt index 5097515049..531ebd406b 100644 --- a/app/src/main/java/eu/kanade/presentation/components/DropdownMenu.kt +++ b/app/src/main/java/eu/kanade/presentation/components/DropdownMenu.kt @@ -19,7 +19,7 @@ import androidx.compose.ui.unit.DpOffset import androidx.compose.ui.unit.dp import androidx.compose.ui.window.PopupProperties import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import androidx.compose.material3.DropdownMenu as ComposeDropdownMenu @Composable @@ -54,13 +54,13 @@ fun RadioMenuItem( if (isChecked) { Icon( imageVector = Icons.Outlined.RadioButtonChecked, - contentDescription = localize(MR.strings.selected), + contentDescription = stringResource(MR.strings.selected), tint = MaterialTheme.colorScheme.primary, ) } else { Icon( imageVector = Icons.Outlined.RadioButtonUnchecked, - contentDescription = localize(MR.strings.not_selected), + contentDescription = stringResource(MR.strings.not_selected), ) } }, diff --git a/app/src/main/java/eu/kanade/presentation/components/TabbedDialog.kt b/app/src/main/java/eu/kanade/presentation/components/TabbedDialog.kt index 9a62b42f0f..dfba8cd612 100644 --- a/app/src/main/java/eu/kanade/presentation/components/TabbedDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/components/TabbedDialog.kt @@ -31,7 +31,7 @@ import kotlinx.coroutines.launch import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.HorizontalPager import tachiyomi.presentation.core.components.material.TabText -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource object TabbedDialogPaddings { val Horizontal = 24.dp @@ -94,7 +94,7 @@ private fun MoreMenu( IconButton(onClick = { expanded = true }) { Icon( imageVector = Icons.Default.MoreVert, - contentDescription = localize(MR.strings.label_more), + contentDescription = stringResource(MR.strings.label_more), ) } DropdownMenu( diff --git a/app/src/main/java/eu/kanade/presentation/components/TabbedScreen.kt b/app/src/main/java/eu/kanade/presentation/components/TabbedScreen.kt index 0e276a1597..e7f185b71d 100644 --- a/app/src/main/java/eu/kanade/presentation/components/TabbedScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/components/TabbedScreen.kt @@ -26,7 +26,7 @@ import kotlinx.coroutines.launch import tachiyomi.presentation.core.components.HorizontalPager import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.TabText -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun TabbedScreen( @@ -52,7 +52,7 @@ fun TabbedScreen( val searchEnabled = tab.searchEnabled SearchToolbar( - titleContent = { AppBarTitle(localize(titleRes)) }, + titleContent = { AppBarTitle(stringResource(titleRes)) }, searchEnabled = searchEnabled, searchQuery = if (searchEnabled) searchQuery else null, onChangeSearchQuery = onChangeSearchQuery, @@ -75,7 +75,7 @@ fun TabbedScreen( Tab( selected = state.currentPage == 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, ) } diff --git a/app/src/main/java/eu/kanade/presentation/crash/CrashScreen.kt b/app/src/main/java/eu/kanade/presentation/crash/CrashScreen.kt index d61600f3f3..f90aeb252c 100644 --- a/app/src/main/java/eu/kanade/presentation/crash/CrashScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/crash/CrashScreen.kt @@ -19,7 +19,7 @@ import eu.kanade.tachiyomi.util.CrashLogUtil import kotlinx.coroutines.launch import tachiyomi.i18n.MR 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 @Composable @@ -32,15 +32,15 @@ fun CrashScreen( InfoScreen( icon = Icons.Outlined.BugReport, - headingText = localize(MR.strings.crash_screen_title), - subtitleText = localize(MR.strings.crash_screen_description, localize(MR.strings.app_name)), - acceptText = localize(MR.strings.pref_dump_crash_logs), + headingText = stringResource(MR.strings.crash_screen_title), + subtitleText = stringResource(MR.strings.crash_screen_description, stringResource(MR.strings.app_name)), + acceptText = stringResource(MR.strings.pref_dump_crash_logs), onAcceptClick = { scope.launch { CrashLogUtil(context).dumpLogs() } }, - rejectText = localize(MR.strings.crash_screen_restart_application), + rejectText = stringResource(MR.strings.crash_screen_restart_application), onRejectClick = onRestartClick, ) { Box( diff --git a/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt b/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt index 9613f0f4c8..ec6416480f 100644 --- a/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt @@ -27,7 +27,7 @@ import tachiyomi.domain.history.model.HistoryWithRelations import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.FastScrollLazyColumn 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.LoadingScreen import uy.kohesive.injekt.Injekt @@ -47,14 +47,14 @@ fun HistoryScreen( Scaffold( topBar = { scrollBehavior -> SearchToolbar( - titleContent = { AppBarTitle(localize(MR.strings.history)) }, + titleContent = { AppBarTitle(stringResource(MR.strings.history)) }, searchQuery = state.searchQuery, onChangeSearchQuery = onSearchQueryChange, actions = { AppBarActions( persistentListOf( AppBar.Action( - title = localize(MR.strings.pref_clear_history), + title = stringResource(MR.strings.pref_clear_history), icon = Icons.Outlined.DeleteSweep, onClick = { onDialogChange(HistoryScreenModel.Dialog.DeleteAll) diff --git a/app/src/main/java/eu/kanade/presentation/history/components/HistoryDialogs.kt b/app/src/main/java/eu/kanade/presentation/history/components/HistoryDialogs.kt index e97bdbcc7e..2ab1922350 100644 --- a/app/src/main/java/eu/kanade/presentation/history/components/HistoryDialogs.kt +++ b/app/src/main/java/eu/kanade/presentation/history/components/HistoryDialogs.kt @@ -15,7 +15,7 @@ import androidx.compose.ui.unit.dp import eu.kanade.presentation.theme.TachiyomiTheme import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.LabeledCheckbox -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun HistoryDeleteDialog( @@ -26,16 +26,16 @@ fun HistoryDeleteDialog( AlertDialog( title = { - Text(text = localize(MR.strings.action_remove)) + Text(text = stringResource(MR.strings.action_remove)) }, text = { Column( 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( - label = localize(MR.strings.dialog_with_checkbox_reset), + label = stringResource(MR.strings.dialog_with_checkbox_reset), checked = removeEverything, onCheckedChange = { removeEverything = it }, ) @@ -47,12 +47,12 @@ fun HistoryDeleteDialog( onDelete(removeEverything) onDismissRequest() }) { - Text(text = localize(MR.strings.action_remove)) + Text(text = stringResource(MR.strings.action_remove)) } }, dismissButton = { TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } }, ) @@ -65,10 +65,10 @@ fun HistoryDeleteAllDialog( ) { AlertDialog( title = { - Text(text = localize(MR.strings.action_remove_everything)) + Text(text = stringResource(MR.strings.action_remove_everything)) }, text = { - Text(text = localize(MR.strings.clear_history_confirmation)) + Text(text = stringResource(MR.strings.clear_history_confirmation)) }, onDismissRequest = onDismissRequest, confirmButton = { @@ -76,12 +76,12 @@ fun HistoryDeleteAllDialog( onDelete() onDismissRequest() }) { - Text(text = localize(MR.strings.action_ok)) + Text(text = stringResource(MR.strings.action_ok)) } }, dismissButton = { TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } }, ) diff --git a/app/src/main/java/eu/kanade/presentation/history/components/HistoryItem.kt b/app/src/main/java/eu/kanade/presentation/history/components/HistoryItem.kt index 1cb3034dce..846903b1b1 100644 --- a/app/src/main/java/eu/kanade/presentation/history/components/HistoryItem.kt +++ b/app/src/main/java/eu/kanade/presentation/history/components/HistoryItem.kt @@ -29,7 +29,7 @@ import eu.kanade.tachiyomi.util.lang.toTimestampString import tachiyomi.domain.history.model.HistoryWithRelations import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.padding -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource private val HistoryItemHeight = 96.dp @@ -69,7 +69,7 @@ fun HistoryItem( val readAt = remember { history.readAt?.toTimestampString() ?: "" } Text( text = if (history.chapterNumber > -1) { - localize( + stringResource( MR.strings.recent_manga_time, formatChapterNumber(history.chapterNumber), readAt, @@ -85,7 +85,7 @@ fun HistoryItem( IconButton(onClick = onClickDelete) { Icon( imageVector = Icons.Outlined.Delete, - contentDescription = localize(MR.strings.action_delete), + contentDescription = stringResource(MR.strings.action_delete), tint = MaterialTheme.colorScheme.onSurface, ) } diff --git a/app/src/main/java/eu/kanade/presentation/library/DeleteLibraryMangaDialog.kt b/app/src/main/java/eu/kanade/presentation/library/DeleteLibraryMangaDialog.kt index 539392b6ae..36346f14ae 100644 --- a/app/src/main/java/eu/kanade/presentation/library/DeleteLibraryMangaDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/library/DeleteLibraryMangaDialog.kt @@ -13,7 +13,7 @@ import dev.icerock.moko.resources.StringResource import tachiyomi.core.preference.CheckboxState import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.LabeledCheckbox -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun DeleteLibraryMangaDialog( @@ -35,7 +35,7 @@ fun DeleteLibraryMangaDialog( onDismissRequest = onDismissRequest, dismissButton = { TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } }, confirmButton = { @@ -49,17 +49,17 @@ fun DeleteLibraryMangaDialog( ) }, ) { - Text(text = localize(MR.strings.action_ok)) + Text(text = stringResource(MR.strings.action_ok)) } }, title = { - Text(text = localize(MR.strings.action_remove)) + Text(text = stringResource(MR.strings.action_remove)) }, text = { Column { list.forEach { state -> LabeledCheckbox( - label = localize(state.value), + label = stringResource(state.value), checked = state.isChecked, onCheckedChange = { val index = list.indexOf(state) diff --git a/app/src/main/java/eu/kanade/presentation/library/LibrarySettingsDialog.kt b/app/src/main/java/eu/kanade/presentation/library/LibrarySettingsDialog.kt index 59d27b2bf1..5c9b092a38 100644 --- a/app/src/main/java/eu/kanade/presentation/library/LibrarySettingsDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/library/LibrarySettingsDialog.kt @@ -30,7 +30,7 @@ import tachiyomi.presentation.core.components.SettingsChipRow import tachiyomi.presentation.core.components.SliderItem import tachiyomi.presentation.core.components.SortItem import tachiyomi.presentation.core.components.TriStateItem -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.util.collectAsState @Composable @@ -42,9 +42,9 @@ fun LibrarySettingsDialog( TabbedDialog( onDismissRequest = onDismissRequest, tabTitles = persistentListOf( - localize(MR.strings.action_filter), - localize(MR.strings.action_sort), - localize(MR.strings.action_display), + stringResource(MR.strings.action_filter), + stringResource(MR.strings.action_sort), + stringResource(MR.strings.action_display), ), ) { page -> Column( @@ -75,7 +75,7 @@ private fun ColumnScope.FilterPage( val filterDownloaded by screenModel.libraryPreferences.filterDownloaded().collectAsState() val downloadedOnly by screenModel.preferences.downloadedOnly().collectAsState() TriStateItem( - label = localize(MR.strings.label_downloaded), + label = stringResource(MR.strings.label_downloaded), state = if (downloadedOnly) { TriState.ENABLED_IS } else { @@ -86,25 +86,25 @@ private fun ColumnScope.FilterPage( ) val filterUnread by screenModel.libraryPreferences.filterUnread().collectAsState() TriStateItem( - label = localize(MR.strings.action_filter_unread), + label = stringResource(MR.strings.action_filter_unread), state = filterUnread, onClick = { screenModel.toggleFilter(LibraryPreferences::filterUnread) }, ) val filterStarted by screenModel.libraryPreferences.filterStarted().collectAsState() TriStateItem( - label = localize(MR.strings.label_started), + label = stringResource(MR.strings.label_started), state = filterStarted, onClick = { screenModel.toggleFilter(LibraryPreferences::filterStarted) }, ) val filterBookmarked by screenModel.libraryPreferences.filterBookmarked().collectAsState() TriStateItem( - label = localize(MR.strings.action_filter_bookmarked), + label = stringResource(MR.strings.action_filter_bookmarked), state = filterBookmarked, onClick = { screenModel.toggleFilter(LibraryPreferences::filterBookmarked) }, ) val filterCompleted by screenModel.libraryPreferences.filterCompleted().collectAsState() TriStateItem( - label = localize(MR.strings.completed), + label = stringResource(MR.strings.completed), state = filterCompleted, onClick = { screenModel.toggleFilter(LibraryPreferences::filterCompleted) }, ) @@ -118,7 +118,7 @@ private fun ColumnScope.FilterPage( val service = trackers[0] val filterTracker by screenModel.libraryPreferences.filterTracking(service.id.toInt()).collectAsState() TriStateItem( - label = localize(MR.strings.action_filter_tracked), + label = stringResource(MR.strings.action_filter_tracked), state = filterTracker, onClick = { screenModel.toggleTracker(service.id.toInt()) }, ) @@ -163,7 +163,7 @@ private fun ColumnScope.SortPage( MR.strings.action_sort_date_added to LibrarySort.Type.DateAdded, ).plus(trackerSortOption).map { (titleRes, mode) -> SortItem( - label = localize(titleRes), + label = stringResource(titleRes), sortDescending = sortDescending.takeIf { sortingMode == mode }, onClick = { val isTogglingDirection = sortingMode == mode @@ -202,7 +202,7 @@ private fun ColumnScope.DisplayPage( FilterChip( selected = displayMode == mode, onClick = { screenModel.setDisplayMode(mode) }, - label = { Text(localize(titleRes)) }, + label = { Text(stringResource(titleRes)) }, ) } } @@ -219,13 +219,13 @@ private fun ColumnScope.DisplayPage( val columns by columnPreference.collectAsState() SliderItem( - label = localize(MR.strings.pref_library_columns), + label = stringResource(MR.strings.pref_library_columns), max = 10, value = columns, valueText = if (columns > 0) { - localize(MR.strings.pref_library_columns_per_row, columns) + stringResource(MR.strings.pref_library_columns_per_row, columns) } else { - localize(MR.strings.label_default) + stringResource(MR.strings.label_default) }, onChange = columnPreference::set, ) @@ -233,29 +233,29 @@ private fun ColumnScope.DisplayPage( HeadingItem(MR.strings.overlay_header) CheckboxItem( - label = localize(MR.strings.action_display_download_badge), + label = stringResource(MR.strings.action_display_download_badge), pref = screenModel.libraryPreferences.downloadBadge(), ) CheckboxItem( - label = localize(MR.strings.action_display_local_badge), + label = stringResource(MR.strings.action_display_local_badge), pref = screenModel.libraryPreferences.localBadge(), ) CheckboxItem( - label = localize(MR.strings.action_display_language_badge), + label = stringResource(MR.strings.action_display_language_badge), pref = screenModel.libraryPreferences.languageBadge(), ) CheckboxItem( - label = localize(MR.strings.action_display_show_continue_reading_button), + label = stringResource(MR.strings.action_display_show_continue_reading_button), pref = screenModel.libraryPreferences.showContinueReadingButton(), ) HeadingItem(MR.strings.tabs_header) CheckboxItem( - label = localize(MR.strings.action_display_show_tabs), + label = stringResource(MR.strings.action_display_show_tabs), pref = screenModel.libraryPreferences.categoryTabs(), ) CheckboxItem( - label = localize(MR.strings.action_display_show_number_of_items), + label = stringResource(MR.strings.action_display_show_number_of_items), pref = screenModel.libraryPreferences.categoryNumberOfItems(), ) } diff --git a/app/src/main/java/eu/kanade/presentation/library/components/CommonMangaItem.kt b/app/src/main/java/eu/kanade/presentation/library/components/CommonMangaItem.kt index 47f215f4e0..83a679336b 100644 --- a/app/src/main/java/eu/kanade/presentation/library/components/CommonMangaItem.kt +++ b/app/src/main/java/eu/kanade/presentation/library/components/CommonMangaItem.kt @@ -40,7 +40,7 @@ import androidx.compose.ui.unit.sp import eu.kanade.presentation.manga.components.MangaCover import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.BadgeGroup -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.util.selectedBackground object CommonMangaItemDefaults { @@ -378,7 +378,7 @@ private fun ContinueReadingButton( ) { Icon( imageVector = Icons.Filled.PlayArrow, - contentDescription = localize(MR.strings.action_resume), + contentDescription = stringResource(MR.strings.action_resume), modifier = Modifier.size(16.dp), ) } diff --git a/app/src/main/java/eu/kanade/presentation/library/components/GlobalSearchItem.kt b/app/src/main/java/eu/kanade/presentation/library/components/GlobalSearchItem.kt index f5e60539b0..c01d58f198 100644 --- a/app/src/main/java/eu/kanade/presentation/library/components/GlobalSearchItem.kt +++ b/app/src/main/java/eu/kanade/presentation/library/components/GlobalSearchItem.kt @@ -6,7 +6,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.zIndex import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable internal fun GlobalSearchItem( @@ -19,7 +19,7 @@ internal fun GlobalSearchItem( onClick = onClick, ) { Text( - text = localize(MR.strings.action_global_search_query, searchQuery), + text = stringResource(MR.strings.action_global_search_query, searchQuery), modifier = Modifier.zIndex(99f), ) } diff --git a/app/src/main/java/eu/kanade/presentation/library/components/LibraryToolbar.kt b/app/src/main/java/eu/kanade/presentation/library/components/LibraryToolbar.kt index 1c660cb0c0..9845ca8166 100644 --- a/app/src/main/java/eu/kanade/presentation/library/components/LibraryToolbar.kt +++ b/app/src/main/java/eu/kanade/presentation/library/components/LibraryToolbar.kt @@ -22,7 +22,7 @@ import eu.kanade.presentation.components.SearchToolbar import kotlinx.collections.immutable.persistentListOf import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.Pill -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.theme.active @Composable @@ -98,21 +98,21 @@ private fun LibraryRegularToolbar( AppBarActions( persistentListOf( AppBar.Action( - title = localize(MR.strings.action_filter), + title = stringResource(MR.strings.action_filter), icon = Icons.Outlined.FilterList, iconTint = filterTint, onClick = onClickFilter, ), AppBar.OverflowAction( - title = localize(MR.strings.action_update_library), + title = stringResource(MR.strings.action_update_library), onClick = onClickGlobalUpdate, ), AppBar.OverflowAction( - title = localize(MR.strings.action_update_category), + title = stringResource(MR.strings.action_update_category), onClick = onClickRefresh, ), AppBar.OverflowAction( - title = localize(MR.strings.action_open_random_manga), + title = stringResource(MR.strings.action_open_random_manga), onClick = onClickOpenRandomManga, ), ), @@ -135,12 +135,12 @@ private fun LibrarySelectionToolbar( AppBarActions( persistentListOf( AppBar.Action( - title = localize(MR.strings.action_select_all), + title = stringResource(MR.strings.action_select_all), icon = Icons.Outlined.SelectAll, onClick = onClickSelectAll, ), AppBar.Action( - title = localize(MR.strings.action_select_inverse), + title = stringResource(MR.strings.action_select_inverse), icon = Icons.Outlined.FlipToBack, onClick = onClickInvertSelection, ), diff --git a/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt b/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt index 6463ab7851..64cba71581 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt @@ -38,7 +38,7 @@ import tachiyomi.presentation.core.components.LabeledCheckbox import tachiyomi.presentation.core.components.RadioItem import tachiyomi.presentation.core.components.SortItem import tachiyomi.presentation.core.components.TriStateItem -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.theme.active @Composable @@ -66,20 +66,20 @@ fun ChapterSettingsDialog( TabbedDialog( onDismissRequest = onDismissRequest, tabTitles = persistentListOf( - localize(MR.strings.action_filter), - localize(MR.strings.action_sort), - localize(MR.strings.action_display), + stringResource(MR.strings.action_filter), + stringResource(MR.strings.action_sort), + stringResource(MR.strings.action_display), ), tabOverflowMenuContent = { closeMenu -> DropdownMenuItem( - text = { Text(localize(MR.strings.set_chapter_settings_as_default)) }, + text = { Text(stringResource(MR.strings.set_chapter_settings_as_default)) }, onClick = { showSetAsDefaultDialog = true closeMenu() }, ) DropdownMenuItem( - text = { Text(localize(MR.strings.action_reset)) }, + text = { Text(stringResource(MR.strings.action_reset)) }, onClick = { onResetToDefault() closeMenu() @@ -136,17 +136,17 @@ private fun ColumnScope.FilterPage( onScanlatorFilterClicked: (() -> Unit), ) { TriStateItem( - label = localize(MR.strings.label_downloaded), + label = stringResource(MR.strings.label_downloaded), state = downloadFilter, onClick = onDownloadFilterChanged, ) TriStateItem( - label = localize(MR.strings.action_filter_unread), + label = stringResource(MR.strings.action_filter_unread), state = unreadFilter, onClick = onUnreadFilterChanged, ) TriStateItem( - label = localize(MR.strings.action_filter_bookmarked), + label = stringResource(MR.strings.action_filter_bookmarked), state = bookmarkedFilter, onClick = onBookmarkedFilterChanged, ) @@ -179,7 +179,7 @@ fun ScanlatorFilterItem( }, ) Text( - text = localize(MR.strings.scanlator), + text = stringResource(MR.strings.scanlator), style = MaterialTheme.typography.bodyMedium, ) } @@ -198,7 +198,7 @@ private fun ColumnScope.SortPage( MR.strings.action_sort_alpha to Manga.CHAPTER_SORTING_ALPHABET, ).map { (titleRes, mode) -> SortItem( - label = localize(titleRes), + label = stringResource(titleRes), sortDescending = sortDescending.takeIf { sortingMode == mode }, onClick = { onItemSelected(mode) }, ) @@ -215,7 +215,7 @@ private fun ColumnScope.DisplayPage( MR.strings.show_chapter_number to Manga.CHAPTER_DISPLAY_NUMBER, ).map { (titleRes, mode) -> RadioItem( - label = localize(titleRes), + label = stringResource(titleRes), selected = displayMode == mode, onClick = { onItemSelected(mode) }, ) @@ -231,15 +231,15 @@ private fun SetAsDefaultDialog( AlertDialog( onDismissRequest = onDismissRequest, - title = { Text(text = localize(MR.strings.chapter_settings)) }, + title = { Text(text = stringResource(MR.strings.chapter_settings)) }, text = { Column( verticalArrangement = Arrangement.spacedBy(12.dp), ) { - Text(text = localize(MR.strings.confirm_set_chapter_settings)) + Text(text = stringResource(MR.strings.confirm_set_chapter_settings)) LabeledCheckbox( - label = localize(MR.strings.also_set_chapter_settings_for_library), + label = stringResource(MR.strings.also_set_chapter_settings_for_library), checked = optionalChecked, onCheckedChange = { optionalChecked = it }, ) @@ -247,7 +247,7 @@ private fun SetAsDefaultDialog( }, dismissButton = { TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } }, confirmButton = { @@ -257,7 +257,7 @@ private fun SetAsDefaultDialog( onDismissRequest() }, ) { - Text(text = localize(MR.strings.action_ok)) + Text(text = stringResource(MR.strings.action_ok)) } }, ) diff --git a/app/src/main/java/eu/kanade/presentation/manga/DuplicateMangaDialog.kt b/app/src/main/java/eu/kanade/presentation/manga/DuplicateMangaDialog.kt index afb8458334..a44a53b37b 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/DuplicateMangaDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/DuplicateMangaDialog.kt @@ -10,7 +10,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun DuplicateMangaDialog( @@ -21,10 +21,10 @@ fun DuplicateMangaDialog( AlertDialog( onDismissRequest = onDismissRequest, title = { - Text(text = localize(MR.strings.are_you_sure)) + Text(text = stringResource(MR.strings.are_you_sure)) }, text = { - Text(text = localize(MR.strings.confirm_add_duplicate_manga)) + Text(text = stringResource(MR.strings.confirm_add_duplicate_manga)) }, confirmButton = { FlowRow( @@ -36,13 +36,13 @@ fun DuplicateMangaDialog( onOpenManga() }, ) { - Text(text = localize(MR.strings.action_show_manga)) + Text(text = stringResource(MR.strings.action_show_manga)) } Spacer(modifier = Modifier.weight(1f)) TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } TextButton( onClick = { @@ -50,7 +50,7 @@ fun DuplicateMangaDialog( onConfirm() }, ) { - Text(text = localize(MR.strings.action_add)) + Text(text = stringResource(MR.strings.action_add)) } } }, diff --git a/app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt b/app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt index 7b52f39317..f5009e962b 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt @@ -74,7 +74,7 @@ import tachiyomi.presentation.core.components.VerticalFastScroller import tachiyomi.presentation.core.components.material.ExtendedFloatingActionButton import tachiyomi.presentation.core.components.material.PullRefresh 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.isScrollingUp import java.text.DateFormat @@ -349,7 +349,9 @@ private fun MangaScreenSmallImpl( val isReading = remember(state.chapters) { 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) }, onClick = onContinueReading, @@ -608,7 +610,9 @@ fun MangaScreenLargeImpl( state.chapters.fastAny { it.chapter.read } } 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) }, @@ -787,7 +791,7 @@ private fun LazyListScope.sharedChapterItems( is ChapterList.Item -> { MangaChapterListItem( title = if (manga.displayMode == Manga.CHAPTER_DISPLAY_NUMBER) { - localize( + stringResource( MR.strings.display_mode_chapter, formatChapterNumber(item.chapter.chapterNumber), ) @@ -806,7 +810,7 @@ private fun LazyListScope.sharedChapterItems( readProgress = item.chapter.lastPageRead .takeIf { !item.chapter.read && it > 0L } ?.let { - localize( + stringResource( MR.strings.chapter_progress, it + 1, ) diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/ChapterDownloadIndicator.kt b/app/src/main/java/eu/kanade/presentation/manga/components/ChapterDownloadIndicator.kt index 9d7eab2631..7e1d0d60bb 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/ChapterDownloadIndicator.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/ChapterDownloadIndicator.kt @@ -36,7 +36,7 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.download.model.Download import tachiyomi.i18n.MR 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 enum class ChapterDownloadAction { @@ -99,7 +99,7 @@ private fun NotDownloadedIndicator( ) { Icon( painter = painterResource(R.drawable.ic_download_chapter_24dp), - contentDescription = localize(MR.strings.manga_download), + contentDescription = stringResource(MR.strings.manga_download), modifier = Modifier.size(IndicatorSize), tint = MaterialTheme.colorScheme.onSurfaceVariant, ) @@ -157,14 +157,14 @@ private fun DownloadingIndicator( } DropdownMenu(expanded = isMenuExpanded, onDismissRequest = { isMenuExpanded = false }) { DropdownMenuItem( - text = { Text(text = localize(MR.strings.action_start_downloading_now)) }, + text = { Text(text = stringResource(MR.strings.action_start_downloading_now)) }, onClick = { onClick(ChapterDownloadAction.START_NOW) isMenuExpanded = false }, ) DropdownMenuItem( - text = { Text(text = localize(MR.strings.action_cancel)) }, + text = { Text(text = stringResource(MR.strings.action_cancel)) }, onClick = { onClick(ChapterDownloadAction.CANCEL) isMenuExpanded = false @@ -205,7 +205,7 @@ private fun DownloadedIndicator( ) DropdownMenu(expanded = isMenuExpanded, onDismissRequest = { isMenuExpanded = false }) { DropdownMenuItem( - text = { Text(text = localize(MR.strings.action_delete)) }, + text = { Text(text = stringResource(MR.strings.action_delete)) }, onClick = { onClick(ChapterDownloadAction.DELETE) isMenuExpanded = false @@ -233,7 +233,7 @@ private fun ErrorIndicator( ) { Icon( imageVector = Icons.Outlined.ErrorOutline, - contentDescription = localize(MR.strings.chapter_error), + contentDescription = stringResource(MR.strings.chapter_error), modifier = Modifier.size(IndicatorSize), tint = MaterialTheme.colorScheme.error, ) diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/ChapterHeader.kt b/app/src/main/java/eu/kanade/presentation/manga/components/ChapterHeader.kt index ef7d5a9231..a193a190ed 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/ChapterHeader.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/ChapterHeader.kt @@ -13,8 +13,8 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.SecondaryItemAlpha -import tachiyomi.presentation.core.i18n.localize -import tachiyomi.presentation.core.i18n.localizePlural +import tachiyomi.presentation.core.i18n.pluralStringResource +import tachiyomi.presentation.core.i18n.stringResource @Composable fun ChapterHeader( @@ -35,9 +35,9 @@ fun ChapterHeader( ) { Text( text = if (chapterCount == null) { - localize(MR.strings.chapters) + stringResource(MR.strings.chapters) } else { - localizePlural(MR.plurals.manga_num_chapters, count = chapterCount, chapterCount) + pluralStringResource(MR.plurals.manga_num_chapters, count = chapterCount, chapterCount) }, style = MaterialTheme.typography.titleMedium, color = MaterialTheme.colorScheme.onBackground, @@ -54,7 +54,7 @@ private fun MissingChaptersWarning(count: Int) { } Text( - text = localizePlural(MR.plurals.missing_chapters, count = count, count), + text = pluralStringResource(MR.plurals.missing_chapters, count = count, count), maxLines = 1, overflow = TextOverflow.Ellipsis, style = MaterialTheme.typography.bodySmall, diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaBottomActionMenu.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaBottomActionMenu.kt index 6ced3000bf..0f2701b7f4 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaBottomActionMenu.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaBottomActionMenu.kt @@ -29,7 +29,6 @@ import androidx.compose.material.icons.outlined.BookmarkRemove import androidx.compose.material.icons.outlined.Delete import androidx.compose.material.icons.outlined.DoneAll import androidx.compose.material.icons.outlined.Download -import androidx.compose.material.icons.outlined.Label import androidx.compose.material.icons.outlined.RemoveDone import androidx.compose.material.ripple.rememberRipple import androidx.compose.material3.Icon @@ -59,7 +58,7 @@ import kotlinx.coroutines.delay import kotlinx.coroutines.isActive import kotlinx.coroutines.launch import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import kotlin.time.Duration.Companion.seconds @Composable @@ -108,7 +107,7 @@ fun MangaBottomActionMenu( ) { if (onBookmarkClicked != null) { Button( - title = localize(MR.strings.action_bookmark), + title = stringResource(MR.strings.action_bookmark), icon = Icons.Outlined.BookmarkAdd, toConfirm = confirm[0], onLongClick = { onLongClickItem(0) }, @@ -117,7 +116,7 @@ fun MangaBottomActionMenu( } if (onRemoveBookmarkClicked != null) { Button( - title = localize(MR.strings.action_remove_bookmark), + title = stringResource(MR.strings.action_remove_bookmark), icon = Icons.Outlined.BookmarkRemove, toConfirm = confirm[1], onLongClick = { onLongClickItem(1) }, @@ -126,7 +125,7 @@ fun MangaBottomActionMenu( } if (onMarkAsReadClicked != null) { Button( - title = localize(MR.strings.action_mark_as_read), + title = stringResource(MR.strings.action_mark_as_read), icon = Icons.Outlined.DoneAll, toConfirm = confirm[2], onLongClick = { onLongClickItem(2) }, @@ -135,7 +134,7 @@ fun MangaBottomActionMenu( } if (onMarkAsUnreadClicked != null) { Button( - title = localize(MR.strings.action_mark_as_unread), + title = stringResource(MR.strings.action_mark_as_unread), icon = Icons.Outlined.RemoveDone, toConfirm = confirm[3], onLongClick = { onLongClickItem(3) }, @@ -144,7 +143,7 @@ fun MangaBottomActionMenu( } if (onMarkPreviousAsReadClicked != null) { Button( - title = localize(MR.strings.action_mark_previous_as_read), + title = stringResource(MR.strings.action_mark_previous_as_read), icon = ImageVector.vectorResource(R.drawable.ic_done_prev_24dp), toConfirm = confirm[4], onLongClick = { onLongClickItem(4) }, @@ -153,7 +152,7 @@ fun MangaBottomActionMenu( } if (onDownloadClicked != null) { Button( - title = localize(MR.strings.action_download), + title = stringResource(MR.strings.action_download), icon = Icons.Outlined.Download, toConfirm = confirm[5], onLongClick = { onLongClickItem(5) }, @@ -162,7 +161,7 @@ fun MangaBottomActionMenu( } if (onDeleteClicked != null) { Button( - title = localize(MR.strings.action_delete), + title = stringResource(MR.strings.action_delete), icon = Icons.Outlined.Delete, toConfirm = confirm[6], onLongClick = { onLongClickItem(6) }, @@ -259,21 +258,21 @@ fun LibraryBottomActionMenu( .padding(horizontal = 8.dp, vertical = 12.dp), ) { Button( - title = localize(MR.strings.action_move_category), + title = stringResource(MR.strings.action_move_category), icon = Icons.AutoMirrored.Outlined.Label, toConfirm = confirm[0], onLongClick = { onLongClickItem(0) }, onClick = onChangeCategoryClicked, ) Button( - title = localize(MR.strings.action_mark_as_read), + title = stringResource(MR.strings.action_mark_as_read), icon = Icons.Outlined.DoneAll, toConfirm = confirm[1], onLongClick = { onLongClickItem(1) }, onClick = onMarkAsReadClicked, ) Button( - title = localize(MR.strings.action_mark_as_unread), + title = stringResource(MR.strings.action_mark_as_unread), icon = Icons.Outlined.RemoveDone, toConfirm = confirm[2], onLongClick = { onLongClickItem(2) }, @@ -282,7 +281,7 @@ fun LibraryBottomActionMenu( if (onDownloadClicked != null) { var downloadExpanded by remember { mutableStateOf(false) } Button( - title = localize(MR.strings.action_download), + title = stringResource(MR.strings.action_download), icon = Icons.Outlined.Download, toConfirm = confirm[3], onLongClick = { onLongClickItem(3) }, @@ -297,7 +296,7 @@ fun LibraryBottomActionMenu( } } Button( - title = localize(MR.strings.action_delete), + title = stringResource(MR.strings.action_delete), icon = Icons.Outlined.Delete, toConfirm = confirm[4], onLongClick = { onLongClickItem(4) }, diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaChapterListItem.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaChapterListItem.kt index ba63a94080..991b494869 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaChapterListItem.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaChapterListItem.kt @@ -52,7 +52,7 @@ import tachiyomi.domain.library.service.LibraryPreferences import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.ReadItemAlpha 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 kotlin.math.absoluteValue @@ -143,7 +143,7 @@ fun MangaChapterListItem( if (!read) { Icon( imageVector = Icons.Filled.Circle, - contentDescription = localize(MR.strings.unread), + contentDescription = stringResource(MR.strings.unread), modifier = Modifier .height(8.dp) .padding(end = 4.dp), @@ -153,7 +153,7 @@ fun MangaChapterListItem( if (bookmark) { Icon( imageVector = Icons.Filled.Bookmark, - contentDescription = localize(MR.strings.action_filter_bookmarked), + contentDescription = stringResource(MR.strings.action_filter_bookmarked), modifier = Modifier .sizeIn(maxHeight = with(LocalDensity.current) { textHeight.toDp() - 2.dp }), tint = MaterialTheme.colorScheme.primary, diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaCoverDialog.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaCoverDialog.kt index 0dc88296c9..b3c06a9792 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaCoverDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaCoverDialog.kt @@ -51,7 +51,7 @@ import kotlinx.collections.immutable.persistentListOf 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.util.clickableNoIndication @Composable @@ -85,7 +85,7 @@ fun MangaCoverDialog( IconButton(onClick = onDismissRequest) { Icon( imageVector = Icons.Outlined.Close, - contentDescription = localize(MR.strings.action_close), + contentDescription = stringResource(MR.strings.action_close), ) } } @@ -94,12 +94,12 @@ fun MangaCoverDialog( AppBarActions( actions = persistentListOf( AppBar.Action( - title = localize(MR.strings.action_share), + title = stringResource(MR.strings.action_share), icon = Icons.Outlined.Share, onClick = onShareClick, ), AppBar.Action( - title = localize(MR.strings.action_save), + title = stringResource(MR.strings.action_save), icon = Icons.Outlined.Save, onClick = onSaveClick, ), @@ -119,7 +119,7 @@ fun MangaCoverDialog( ) { Icon( imageVector = Icons.Outlined.Edit, - contentDescription = localize(MR.strings.action_edit_cover), + contentDescription = stringResource(MR.strings.action_edit_cover), ) } DropdownMenu( @@ -128,14 +128,14 @@ fun MangaCoverDialog( offset = DpOffset(8.dp, 0.dp), ) { DropdownMenuItem( - text = { Text(text = localize(MR.strings.action_edit)) }, + text = { Text(text = stringResource(MR.strings.action_edit)) }, onClick = { onEditClick(EditCoverAction.EDIT) expanded = false }, ) DropdownMenuItem( - text = { Text(text = localize(MR.strings.action_delete)) }, + text = { Text(text = stringResource(MR.strings.action_delete)) }, onClick = { onEditClick(EditCoverAction.DELETE) expanded = false diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt index d6d2ede8d2..268928ebbe 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaDialogs.kt @@ -18,7 +18,7 @@ import kotlinx.collections.immutable.toImmutableList import tachiyomi.domain.manga.interactor.FetchInterval import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.WheelTextPicker -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun DeleteChaptersDialog( @@ -29,7 +29,7 @@ fun DeleteChaptersDialog( onDismissRequest = onDismissRequest, dismissButton = { TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } }, confirmButton = { @@ -39,14 +39,14 @@ fun DeleteChaptersDialog( onConfirm() }, ) { - Text(text = localize(MR.strings.action_ok)) + Text(text = stringResource(MR.strings.action_ok)) } }, title = { - Text(text = localize(MR.strings.are_you_sure)) + Text(text = stringResource(MR.strings.are_you_sure)) }, text = { - Text(text = localize(MR.strings.confirm_delete_chapters)) + Text(text = stringResource(MR.strings.confirm_delete_chapters)) }, ) } @@ -61,7 +61,7 @@ fun SetIntervalDialog( AlertDialog( onDismissRequest = onDismissRequest, - title = { Text(text = localize(MR.strings.manga_modify_calculated_interval_title)) }, + title = { Text(text = stringResource(MR.strings.manga_modify_calculated_interval_title)) }, text = { BoxWithConstraints( modifier = Modifier.fillMaxWidth(), @@ -71,7 +71,7 @@ fun SetIntervalDialog( val items = (0..FetchInterval.MAX_INTERVAL) .map { if (it == 0) { - localize(MR.strings.label_default) + stringResource(MR.strings.label_default) } else { it.toString() } @@ -87,7 +87,7 @@ fun SetIntervalDialog( }, dismissButton = { TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } }, confirmButton = { @@ -95,7 +95,7 @@ fun SetIntervalDialog( onValueChanged(selectedInterval) onDismissRequest() }) { - Text(text = localize(MR.strings.action_ok)) + Text(text = stringResource(MR.strings.action_ok)) } }, ) diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt index 8d19564680..01a94057a8 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt @@ -81,8 +81,8 @@ import tachiyomi.domain.manga.model.Manga import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.TextButton import tachiyomi.presentation.core.components.material.padding -import tachiyomi.presentation.core.i18n.localize -import tachiyomi.presentation.core.i18n.localizePlural +import tachiyomi.presentation.core.i18n.pluralStringResource +import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.util.clickableNoIndication import tachiyomi.presentation.core.util.secondaryItemAlpha import kotlin.math.absoluteValue @@ -179,9 +179,9 @@ fun MangaActionRow( Row(modifier = modifier.padding(start = 16.dp, top = 8.dp, end = 16.dp)) { MangaActionButton( title = if (favorite) { - localize(MR.strings.in_library) + stringResource(MR.strings.in_library) } else { - localize(MR.strings.add_to_library) + stringResource(MR.strings.add_to_library) }, icon = if (favorite) Icons.Filled.Favorite else Icons.Outlined.FavoriteBorder, color = if (favorite) MaterialTheme.colorScheme.primary else defaultActionButtonColor, @@ -190,7 +190,7 @@ fun MangaActionRow( ) if (onEditIntervalClicked != null && fetchInterval != null) { MangaActionButton( - title = localizePlural( + title = pluralStringResource( MR.plurals.day, count = fetchInterval.absoluteValue, fetchInterval.absoluteValue, @@ -203,9 +203,9 @@ fun MangaActionRow( if (onTrackingClicked != null) { MangaActionButton( title = if (trackingCount == 0) { - localize(MR.strings.manga_tracking_tab) + stringResource(MR.strings.manga_tracking_tab) } 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, color = if (trackingCount == 0) defaultActionButtonColor else MaterialTheme.colorScheme.primary, @@ -214,7 +214,7 @@ fun MangaActionRow( } if (onWebViewClicked != null) { MangaActionButton( - title = localize(MR.strings.action_web_view), + title = stringResource(MR.strings.action_web_view), icon = Icons.Outlined.Public, color = defaultActionButtonColor, onClick = onWebViewClicked, @@ -238,7 +238,7 @@ fun ExpandableMangaDescription( mutableStateOf(defaultExpandState) } val desc = - description.takeIf { !it.isNullOrBlank() } ?: localize(MR.strings.description_placeholder) + description.takeIf { !it.isNullOrBlank() } ?: stringResource(MR.strings.description_placeholder) val trimmedDescription = remember(desc) { desc .replace(whitespaceLineRegex, "\n") @@ -268,14 +268,14 @@ fun ExpandableMangaDescription( onDismissRequest = { showMenu = false }, ) { DropdownMenuItem( - text = { Text(text = localize(MR.strings.action_search)) }, + text = { Text(text = stringResource(MR.strings.action_search)) }, onClick = { onTagSearch(tagSelected) showMenu = false }, ) DropdownMenuItem( - text = { Text(text = localize(MR.strings.action_copy_to_clipboard)) }, + text = { Text(text = stringResource(MR.strings.action_copy_to_clipboard)) }, onClick = { onCopyTagToClipboard(tagSelected) showMenu = false @@ -342,7 +342,7 @@ private fun MangaAndSourceTitlesLarge( MangaCover.Book( modifier = Modifier.fillMaxWidth(0.65f), data = coverDataProvider(), - contentDescription = localize(MR.strings.manga_cover), + contentDescription = stringResource(MR.strings.manga_cover), onClick = onCoverClick, ) Spacer(modifier = Modifier.height(16.dp)) @@ -384,7 +384,7 @@ private fun MangaAndSourceTitlesSmall( .sizeIn(maxWidth = 100.dp) .align(Alignment.Top), data = coverDataProvider(), - contentDescription = localize(MR.strings.manga_cover), + contentDescription = stringResource(MR.strings.manga_cover), onClick = onCoverClick, ) Column( @@ -416,7 +416,7 @@ private fun MangaContentInfo( ) { val context = LocalContext.current Text( - text = title.ifBlank { localize(MR.strings.unknown_title) }, + text = title.ifBlank { stringResource(MR.strings.unknown_title) }, style = MaterialTheme.typography.titleLarge, modifier = Modifier.clickableNoIndication( onLongClick = { @@ -446,7 +446,7 @@ private fun MangaContentInfo( ) Text( text = author?.takeIf { it.isNotBlank() } - ?: localize(MR.strings.unknown_author), + ?: stringResource(MR.strings.unknown_author), style = MaterialTheme.typography.titleSmall, modifier = Modifier .clickableNoIndication( @@ -512,13 +512,13 @@ private fun MangaContentInfo( ProvideTextStyle(MaterialTheme.typography.bodyMedium) { Text( text = when (status) { - SManga.ONGOING.toLong() -> localize(MR.strings.ongoing) - SManga.COMPLETED.toLong() -> localize(MR.strings.completed) - SManga.LICENSED.toLong() -> localize(MR.strings.licensed) - SManga.PUBLISHING_FINISHED.toLong() -> localize(MR.strings.publishing_finished) - SManga.CANCELLED.toLong() -> localize(MR.strings.cancelled) - SManga.ON_HIATUS.toLong() -> localize(MR.strings.on_hiatus) - else -> localize(MR.strings.unknown) + SManga.ONGOING.toLong() -> stringResource(MR.strings.ongoing) + SManga.COMPLETED.toLong() -> stringResource(MR.strings.completed) + SManga.LICENSED.toLong() -> stringResource(MR.strings.licensed) + SManga.PUBLISHING_FINISHED.toLong() -> stringResource(MR.strings.publishing_finished) + SManga.CANCELLED.toLong() -> stringResource(MR.strings.cancelled) + SManga.ON_HIATUS.toLong() -> stringResource(MR.strings.on_hiatus) + else -> stringResource(MR.strings.unknown) }, overflow = TextOverflow.Ellipsis, maxLines = 1, @@ -592,7 +592,7 @@ private fun MangaSummary( val image = AnimatedImageVector.animatedVectorResource(R.drawable.anim_caret_down) Icon( painter = rememberAnimatedVectorPainter(image, !expanded), - contentDescription = localize( + contentDescription = stringResource( if (expanded) MR.strings.manga_info_collapse else MR.strings.manga_info_expand, ), tint = MaterialTheme.colorScheme.onBackground, diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaToolbar.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaToolbar.kt index 36631d3158..5aa17a449f 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaToolbar.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaToolbar.kt @@ -30,7 +30,7 @@ import eu.kanade.presentation.components.UpIcon import eu.kanade.presentation.manga.DownloadAction import kotlinx.collections.immutable.persistentListOf import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.theme.active @Composable @@ -75,12 +75,12 @@ fun MangaToolbar( AppBarActions( persistentListOf( AppBar.Action( - title = localize(MR.strings.action_select_all), + title = stringResource(MR.strings.action_select_all), icon = Icons.Outlined.SelectAll, onClick = onSelectAll, ), AppBar.Action( - title = localize(MR.strings.action_select_inverse), + title = stringResource(MR.strings.action_select_inverse), icon = Icons.Outlined.FlipToBack, onClick = onInvertSelection, ), @@ -104,7 +104,7 @@ fun MangaToolbar( if (onClickDownload != null) { add( AppBar.Action( - title = localize(MR.strings.manga_download), + title = stringResource(MR.strings.manga_download), icon = Icons.Outlined.Download, onClick = { downloadExpanded = !downloadExpanded }, ), @@ -112,7 +112,7 @@ fun MangaToolbar( } add( AppBar.Action( - title = localize(MR.strings.action_filter), + title = stringResource(MR.strings.action_filter), icon = Icons.Outlined.FilterList, iconTint = filterTint, onClick = onClickFilter, @@ -120,14 +120,14 @@ fun MangaToolbar( ) add( AppBar.OverflowAction( - title = localize(MR.strings.action_webview_refresh), + title = stringResource(MR.strings.action_webview_refresh), onClick = onClickRefresh, ), ) if (onClickEditCategory != null) { add( AppBar.OverflowAction( - title = localize(MR.strings.action_edit_categories), + title = stringResource(MR.strings.action_edit_categories), onClick = onClickEditCategory, ), ) @@ -135,7 +135,7 @@ fun MangaToolbar( if (onClickMigrate != null) { add( AppBar.OverflowAction( - title = localize(MR.strings.action_migrate), + title = stringResource(MR.strings.action_migrate), onClick = onClickMigrate, ), ) @@ -143,7 +143,7 @@ fun MangaToolbar( if (onClickShare != null) { add( AppBar.OverflowAction( - title = localize(MR.strings.action_share), + title = stringResource(MR.strings.action_share), onClick = onClickShare, ), ) diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MissingChapterCountListItem.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MissingChapterCountListItem.kt index 557b051a51..e40f1bd693 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MissingChapterCountListItem.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MissingChapterCountListItem.kt @@ -14,7 +14,7 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark import eu.kanade.presentation.theme.TachiyomiTheme import tachiyomi.i18n.MR 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 @Composable @@ -34,7 +34,7 @@ fun MissingChapterCountListItem( ) { HorizontalDivider(modifier = Modifier.weight(1f)) Text( - text = localizePlural(MR.plurals.missing_chapters, count = count, count), + text = pluralStringResource(MR.plurals.missing_chapters, count = count, count), style = MaterialTheme.typography.labelMedium, ) HorizontalDivider(modifier = Modifier.weight(1f)) diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/ScanlatorFilterDialog.kt b/app/src/main/java/eu/kanade/presentation/manga/components/ScanlatorFilterDialog.kt index b5500b3e87..d7c46e90d5 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/ScanlatorFilterDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/ScanlatorFilterDialog.kt @@ -20,9 +20,7 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.minimumInteractiveComponentSize import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue import androidx.compose.runtime.toMutableStateList import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -32,7 +30,7 @@ import androidx.compose.ui.window.DialogProperties import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.TextButton 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.isScrolledToStart @@ -49,10 +47,10 @@ fun ScanlatorFilterDialog( val mutableExcludedScanlators = remember(excludedScanlators) { excludedScanlators.toMutableStateList() } AlertDialog( onDismissRequest = onDismissRequest, - title = { Text(text = localize(MR.strings.exclude_scanlators)) }, + title = { Text(text = stringResource(MR.strings.exclude_scanlators)) }, text = textFunc@{ if (sortedAvailableScanlators.isEmpty()) { - Text(text = localize(MR.strings.no_scanlators_found)) + Text(text = stringResource(MR.strings.no_scanlators_found)) return@textFunc } Box { @@ -108,16 +106,16 @@ fun ScanlatorFilterDialog( confirmButton = { if (sortedAvailableScanlators.isEmpty()) { TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } } else { FlowRow { TextButton(onClick = mutableExcludedScanlators::clear) { - Text(text = localize(MR.strings.action_reset)) + Text(text = stringResource(MR.strings.action_reset)) } Spacer(modifier = Modifier.weight(1f)) TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } TextButton( onClick = { @@ -125,7 +123,7 @@ fun ScanlatorFilterDialog( onDismissRequest() }, ) { - Text(text = localize(MR.strings.action_ok)) + Text(text = stringResource(MR.strings.action_ok)) } } } diff --git a/app/src/main/java/eu/kanade/presentation/more/MoreScreen.kt b/app/src/main/java/eu/kanade/presentation/more/MoreScreen.kt index 08bedc3e90..8a3b1f9fe8 100644 --- a/app/src/main/java/eu/kanade/presentation/more/MoreScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/MoreScreen.kt @@ -32,8 +32,8 @@ import tachiyomi.core.Constants import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.ScrollbarLazyColumn import tachiyomi.presentation.core.components.material.Scaffold -import tachiyomi.presentation.core.i18n.localize -import tachiyomi.presentation.core.i18n.localizePlural +import tachiyomi.presentation.core.i18n.pluralStringResource +import tachiyomi.presentation.core.i18n.stringResource @Composable fun MoreScreen( @@ -80,8 +80,8 @@ fun MoreScreen( } item { SwitchPreferenceWidget( - title = localize(MR.strings.label_downloaded_only), - subtitle = localize(MR.strings.downloaded_only_summary), + title = stringResource(MR.strings.label_downloaded_only), + subtitle = stringResource(MR.strings.downloaded_only_summary), icon = Icons.Outlined.CloudOff, checked = downloadedOnly, onCheckedChanged = onDownloadedOnlyChange, @@ -89,8 +89,8 @@ fun MoreScreen( } item { SwitchPreferenceWidget( - title = localize(MR.strings.pref_incognito_mode), - subtitle = localize(MR.strings.pref_incognito_mode_summary), + title = stringResource(MR.strings.pref_incognito_mode), + subtitle = stringResource(MR.strings.pref_incognito_mode_summary), icon = ImageVector.vectorResource(R.drawable.ic_glasses_24dp), checked = incognitoMode, onCheckedChanged = onIncognitoModeChange, @@ -102,16 +102,16 @@ fun MoreScreen( item { val downloadQueueState = downloadQueueStateProvider() TextPreferenceWidget( - title = localize(MR.strings.label_download_queue), + title = stringResource(MR.strings.label_download_queue), subtitle = when (downloadQueueState) { DownloadQueueState.Stopped -> null is DownloadQueueState.Paused -> { val pending = downloadQueueState.pending if (pending == 0) { - localize(MR.strings.paused) + stringResource(MR.strings.paused) } else { - "${localize(MR.strings.paused)} • ${ - localizePlural( + "${stringResource(MR.strings.paused)} • ${ + pluralStringResource( MR.plurals.download_queue_summary, count = pending, pending, @@ -121,7 +121,7 @@ fun MoreScreen( } is DownloadQueueState.Downloading -> { val pending = downloadQueueState.pending - localizePlural(MR.plurals.download_queue_summary, count = pending, pending) + pluralStringResource(MR.plurals.download_queue_summary, count = pending, pending) } }, icon = Icons.Outlined.GetApp, @@ -130,21 +130,21 @@ fun MoreScreen( } item { TextPreferenceWidget( - title = localize(MR.strings.categories), + title = stringResource(MR.strings.categories), icon = Icons.AutoMirrored.Outlined.Label, onPreferenceClick = onClickCategories, ) } item { TextPreferenceWidget( - title = localize(MR.strings.label_stats), + title = stringResource(MR.strings.label_stats), icon = Icons.Outlined.QueryStats, onPreferenceClick = onClickStats, ) } item { TextPreferenceWidget( - title = localize(MR.strings.label_data_storage), + title = stringResource(MR.strings.label_data_storage), icon = Icons.Outlined.Storage, onPreferenceClick = onClickDataAndStorage, ) @@ -154,21 +154,21 @@ fun MoreScreen( item { TextPreferenceWidget( - title = localize(MR.strings.label_settings), + title = stringResource(MR.strings.label_settings), icon = Icons.Outlined.Settings, onPreferenceClick = onClickSettings, ) } item { TextPreferenceWidget( - title = localize(MR.strings.pref_category_about), + title = stringResource(MR.strings.pref_category_about), icon = Icons.Outlined.Info, onPreferenceClick = onClickAbout, ) } item { TextPreferenceWidget( - title = localize(MR.strings.label_help), + title = stringResource(MR.strings.label_help), icon = Icons.AutoMirrored.Outlined.HelpOutline, onPreferenceClick = { uriHandler.openUri(Constants.URL_HELP) }, ) diff --git a/app/src/main/java/eu/kanade/presentation/more/NewUpdateScreen.kt b/app/src/main/java/eu/kanade/presentation/more/NewUpdateScreen.kt index ff584e2a94..33656e3881 100644 --- a/app/src/main/java/eu/kanade/presentation/more/NewUpdateScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/NewUpdateScreen.kt @@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.material.icons.Icons 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.material3.Icon import androidx.compose.material3.MaterialTheme @@ -23,7 +22,7 @@ import com.halilibo.richtext.ui.string.RichTextStringStyle import eu.kanade.presentation.theme.TachiyomiTheme import tachiyomi.i18n.MR 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 @Composable @@ -36,11 +35,11 @@ fun NewUpdateScreen( ) { InfoScreen( icon = Icons.Outlined.NewReleases, - headingText = localize(MR.strings.update_check_notification_update_available), + headingText = stringResource(MR.strings.update_check_notification_update_available), subtitleText = versionName, - acceptText = localize(MR.strings.update_check_confirm), + acceptText = stringResource(MR.strings.update_check_confirm), onAcceptClick = onAcceptUpdate, - rejectText = localize(MR.strings.action_not_now), + rejectText = stringResource(MR.strings.action_not_now), onRejectClick = onRejectUpdate, ) { Material3RichText( @@ -59,7 +58,7 @@ fun NewUpdateScreen( onClick = onOpenInBrowser, 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)) Icon(imageVector = Icons.AutoMirrored.Outlined.OpenInNew, contentDescription = null) } diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/Preference.kt b/app/src/main/java/eu/kanade/presentation/more/settings/Preference.kt index afb12287b9..c8f99b5930 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/Preference.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/Preference.kt @@ -5,7 +5,7 @@ import androidx.compose.runtime.remember import androidx.compose.ui.graphics.vector.ImageVector import eu.kanade.tachiyomi.data.track.Tracker import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.core.preference.Preference as PreferenceData sealed class Preference { @@ -109,7 +109,7 @@ sealed class Preference { v.map { e[it] } .takeIf { it.isNotEmpty() } ?.joinToString() - } ?: localize(MR.strings.none) + } ?: stringResource(MR.strings.none) subtitle?.format(combined) }, override val icon: ImageVector? = null, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/PreferenceScaffold.kt b/app/src/main/java/eu/kanade/presentation/more/settings/PreferenceScaffold.kt index 541dd6a532..bc68af5fc7 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/PreferenceScaffold.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/PreferenceScaffold.kt @@ -5,7 +5,7 @@ import androidx.compose.runtime.Composable import dev.icerock.moko.resources.StringResource import eu.kanade.presentation.components.AppBar import tachiyomi.presentation.core.components.material.Scaffold -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun PreferenceScaffold( @@ -17,7 +17,7 @@ fun PreferenceScaffold( Scaffold( topBar = { AppBar( - title = localize(titleRes), + title = stringResource(titleRes), navigateUp = onBackPressed, actions = actions, scrollBehavior = it, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/Commons.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/Commons.kt index a5acb0fb18..dc128a7aad 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/Commons.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/Commons.kt @@ -6,7 +6,7 @@ import androidx.compose.ui.platform.LocalContext import eu.kanade.presentation.category.visualName import tachiyomi.domain.category.model.Category 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 @@ -34,15 +34,15 @@ fun getCategoriesLabel( includedCategories.isNotEmpty() && includedCategories.size != allCategories.size -> includedCategories.joinToString { it.visualName(context) } // All explicitly selected - includedCategories.size == allCategories.size -> localize(MR.strings.all) - allExcluded -> localize(MR.strings.none) - else -> localize(MR.strings.all) + includedCategories.size == allCategories.size -> stringResource(MR.strings.all) + allExcluded -> stringResource(MR.strings.none) + else -> stringResource(MR.strings.all) } val excludedItemsText = when { - excludedCategories.isEmpty() -> localize(MR.strings.none) - allExcluded -> localize(MR.strings.all) + excludedCategories.isEmpty() -> stringResource(MR.strings.none) + allExcluded -> stringResource(MR.strings.all) else -> excludedCategories.joinToString { it.visualName(context) } } - return localize(MR.strings.include, includedItemsText) + "\n" + - localize(MR.strings.exclude, excludedItemsText) + return stringResource(MR.strings.include, includedItemsText) + "\n" + + stringResource(MR.strings.exclude, excludedItemsText) } diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt index c384b010b5..474036247e 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt @@ -58,7 +58,7 @@ import tachiyomi.core.util.lang.withUIContext import tachiyomi.core.util.system.logcat import tachiyomi.domain.manga.interactor.ResetViewerFlags import tachiyomi.i18n.MR -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 @@ -84,13 +84,13 @@ object SettingsAdvancedScreen : SearchableSettings { listOf( Preference.PreferenceItem.SwitchPreference( pref = basePreferences.acraEnabled(), - title = localize(MR.strings.pref_enable_acra), - subtitle = localize(MR.strings.pref_acra_summary), + title = stringResource(MR.strings.pref_enable_acra), + subtitle = stringResource(MR.strings.pref_acra_summary), enabled = isPreviewBuildType || isReleaseBuildType, ), Preference.PreferenceItem.TextPreference( - title = localize(MR.strings.pref_dump_crash_logs), - subtitle = localize(MR.strings.pref_dump_crash_logs_summary), + title = stringResource(MR.strings.pref_dump_crash_logs), + subtitle = stringResource(MR.strings.pref_dump_crash_logs_summary), onClick = { scope.launch { CrashLogUtil(context).dumpLogs() @@ -99,15 +99,15 @@ object SettingsAdvancedScreen : SearchableSettings { ), Preference.PreferenceItem.SwitchPreference( pref = networkPreferences.verboseLogging(), - title = localize(MR.strings.pref_verbose_logging), - subtitle = localize(MR.strings.pref_verbose_logging_summary), + title = stringResource(MR.strings.pref_verbose_logging), + subtitle = stringResource(MR.strings.pref_verbose_logging_summary), onValueChanged = { context.toast(MR.strings.requires_app_restart) true }, ), Preference.PreferenceItem.TextPreference( - title = localize(MR.strings.pref_debug_info), + title = stringResource(MR.strings.pref_debug_info), onClick = { navigator.push(DebugInfoScreen()) }, ), ), @@ -115,7 +115,7 @@ object SettingsAdvancedScreen : SearchableSettings { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { add( Preference.PreferenceItem.TextPreference( - title = localize(MR.strings.pref_manage_notifications), + title = stringResource(MR.strings.pref_manage_notifications), onClick = { val intent = Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS).apply { putExtra(Settings.EXTRA_APP_PACKAGE, context.packageName) @@ -143,11 +143,11 @@ object SettingsAdvancedScreen : SearchableSettings { val uriHandler = LocalUriHandler.current return Preference.PreferenceGroup( - title = localize(MR.strings.label_background_activity), + title = stringResource(MR.strings.label_background_activity), preferenceItems = listOf( Preference.PreferenceItem.TextPreference( - title = localize(MR.strings.pref_disable_battery_optimization), - subtitle = localize(MR.strings.pref_disable_battery_optimization_summary), + title = stringResource(MR.strings.pref_disable_battery_optimization), + subtitle = stringResource(MR.strings.pref_disable_battery_optimization_summary), onClick = { val packageName: String = context.packageName if (!context.powerManager.isIgnoringBatteryOptimizations(packageName)) { @@ -169,7 +169,7 @@ object SettingsAdvancedScreen : SearchableSettings { ), Preference.PreferenceItem.TextPreference( title = "Don't kill my app!", - subtitle = localize(MR.strings.about_dont_kill_my_app), + subtitle = stringResource(MR.strings.about_dont_kill_my_app), onClick = { uriHandler.openUri("https://dontkillmyapp.com/") }, ), ), @@ -182,19 +182,19 @@ object SettingsAdvancedScreen : SearchableSettings { val navigator = LocalNavigator.currentOrThrow return Preference.PreferenceGroup( - title = localize(MR.strings.label_data), + title = stringResource(MR.strings.label_data), preferenceItems = listOf( Preference.PreferenceItem.TextPreference( - title = localize(MR.strings.pref_invalidate_download_cache), - subtitle = localize(MR.strings.pref_invalidate_download_cache_summary), + title = stringResource(MR.strings.pref_invalidate_download_cache), + subtitle = stringResource(MR.strings.pref_invalidate_download_cache_summary), onClick = { Injekt.get().invalidateCache() context.toast(MR.strings.download_cache_invalidated) }, ), Preference.PreferenceItem.TextPreference( - title = localize(MR.strings.pref_clear_database), - subtitle = localize(MR.strings.pref_clear_database_summary), + title = stringResource(MR.strings.pref_clear_database), + subtitle = stringResource(MR.strings.pref_clear_database_summary), onClick = { navigator.push(ClearDatabaseScreen()) }, ), ), @@ -212,17 +212,17 @@ object SettingsAdvancedScreen : SearchableSettings { val userAgent by userAgentPref.collectAsState() return Preference.PreferenceGroup( - title = localize(MR.strings.label_network), + title = stringResource(MR.strings.label_network), preferenceItems = listOf( Preference.PreferenceItem.TextPreference( - title = localize(MR.strings.pref_clear_cookies), + title = stringResource(MR.strings.pref_clear_cookies), onClick = { networkHelper.cookieJar.removeAll() context.toast(MR.strings.cookies_cleared) }, ), Preference.PreferenceItem.TextPreference( - title = localize(MR.strings.pref_clear_webview_data), + title = stringResource(MR.strings.pref_clear_webview_data), onClick = { try { WebView(context).run { @@ -243,9 +243,9 @@ object SettingsAdvancedScreen : SearchableSettings { ), Preference.PreferenceItem.ListPreference( pref = networkPreferences.dohProvider(), - title = localize(MR.strings.pref_dns_over_https), + title = stringResource(MR.strings.pref_dns_over_https), entries = mapOf( - -1 to localize(MR.strings.disabled), + -1 to stringResource(MR.strings.disabled), PREF_DOH_CLOUDFLARE to "Cloudflare", PREF_DOH_GOOGLE to "Google", PREF_DOH_ADGUARD to "AdGuard", @@ -266,7 +266,7 @@ object SettingsAdvancedScreen : SearchableSettings { ), Preference.PreferenceItem.EditTextPreference( pref = userAgentPref, - title = localize(MR.strings.pref_user_agent_string), + title = stringResource(MR.strings.pref_user_agent_string), onValueChanged = { try { // OkHttp checks for valid values internally @@ -279,7 +279,7 @@ object SettingsAdvancedScreen : SearchableSettings { }, ), Preference.PreferenceItem.TextPreference( - title = localize(MR.strings.pref_reset_user_agent_string), + title = stringResource(MR.strings.pref_reset_user_agent_string), enabled = remember(userAgent) { userAgent != userAgentPref.defaultValue() }, onClick = { userAgentPref.delete() @@ -296,15 +296,15 @@ object SettingsAdvancedScreen : SearchableSettings { val context = LocalContext.current return Preference.PreferenceGroup( - title = localize(MR.strings.label_library), + title = stringResource(MR.strings.label_library), preferenceItems = listOf( Preference.PreferenceItem.TextPreference( - title = localize(MR.strings.pref_refresh_library_covers), + title = stringResource(MR.strings.pref_refresh_library_covers), onClick = { MetadataUpdateJob.startNow(context) }, ), Preference.PreferenceItem.TextPreference( - title = localize(MR.strings.pref_reset_viewer_flags), - subtitle = localize(MR.strings.pref_reset_viewer_flags_summary), + title = stringResource(MR.strings.pref_reset_viewer_flags), + subtitle = stringResource(MR.strings.pref_reset_viewer_flags_summary), onClick = { scope.launchNonCancellable { val success = Injekt.get().await() @@ -336,11 +336,11 @@ object SettingsAdvancedScreen : SearchableSettings { val dismiss = { shizukuMissing = false } AlertDialog( onDismissRequest = dismiss, - title = { Text(text = localize(MR.strings.ext_installer_shizuku)) }, - text = { Text(text = localize(MR.strings.ext_installer_shizuku_unavailable_dialog)) }, + title = { Text(text = stringResource(MR.strings.ext_installer_shizuku)) }, + text = { Text(text = stringResource(MR.strings.ext_installer_shizuku_unavailable_dialog)) }, dismissButton = { TextButton(onClick = dismiss) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } }, confirmButton = { @@ -350,19 +350,19 @@ object SettingsAdvancedScreen : SearchableSettings { uriHandler.openUri("https://shizuku.rikka.app/download") }, ) { - Text(text = localize(MR.strings.action_ok)) + Text(text = stringResource(MR.strings.action_ok)) } }, ) } return Preference.PreferenceGroup( - title = localize(MR.strings.label_extensions), + title = stringResource(MR.strings.label_extensions), preferenceItems = listOf( Preference.PreferenceItem.ListPreference( pref = extensionInstallerPref, - title = localize(MR.strings.ext_installer_pref), + title = stringResource(MR.strings.ext_installer_pref), entries = extensionInstallerPref.entries - .associateWith { localize(it.titleRes) }, + .associateWith { stringResource(it.titleRes) }, onValueChanged = { if (it == BasePreferences.ExtensionInstaller.SHIZUKU && !context.isShizukuInstalled diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAppearanceScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAppearanceScreen.kt index 7875008ac5..667afa505d 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAppearanceScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAppearanceScreen.kt @@ -27,9 +27,9 @@ import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.drop import kotlinx.coroutines.flow.merge import org.xmlpull.v1.XmlPullParser -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 import tachiyomi.presentation.core.util.collectAsState import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get @@ -76,26 +76,26 @@ object SettingsAppearanceScreen : SearchableSettings { } return Preference.PreferenceGroup( - title = localize(MR.strings.pref_category_theme), + title = stringResource(MR.strings.pref_category_theme), preferenceItems = listOf( Preference.PreferenceItem.ListPreference( 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) { mapOf( - ThemeMode.SYSTEM to localize(MR.strings.theme_system), - ThemeMode.LIGHT to localize(MR.strings.theme_light), - ThemeMode.DARK to localize(MR.strings.theme_dark), + ThemeMode.SYSTEM to stringResource(MR.strings.theme_system), + ThemeMode.LIGHT to stringResource(MR.strings.theme_light), + ThemeMode.DARK to stringResource(MR.strings.theme_dark), ) } else { mapOf( - ThemeMode.LIGHT to localize(MR.strings.theme_light), - ThemeMode.DARK to localize(MR.strings.theme_dark), + ThemeMode.LIGHT to stringResource(MR.strings.theme_light), + ThemeMode.DARK to stringResource(MR.strings.theme_dark), ) }, ), Preference.PreferenceItem.CustomPreference( - title = localize(MR.strings.pref_app_theme), + title = stringResource(MR.strings.pref_app_theme), ) { item -> val value by appThemePref.collectAsState() AppThemePreferenceWidget( @@ -107,7 +107,7 @@ object SettingsAppearanceScreen : SearchableSettings { }, Preference.PreferenceItem.SwitchPreference( pref = amoledPref, - title = localize(MR.strings.pref_dark_theme_pure_black), + title = stringResource(MR.strings.pref_dark_theme_pure_black), enabled = themeMode != ThemeMode.LIGHT, ), ), @@ -140,11 +140,11 @@ object SettingsAppearanceScreen : SearchableSettings { } return Preference.PreferenceGroup( - title = localize(MR.strings.pref_category_display), + title = stringResource(MR.strings.pref_category_display), preferenceItems = listOf( Preference.PreferenceItem.BasicListPreference( value = currentLanguage, - title = localize(MR.strings.pref_app_language), + title = stringResource(MR.strings.pref_app_language), entries = langs, onValueChanged = { newValue -> currentLanguage = newValue @@ -153,8 +153,8 @@ object SettingsAppearanceScreen : SearchableSettings { ), Preference.PreferenceItem.ListPreference( pref = uiPreferences.tabletUiMode(), - title = localize(MR.strings.pref_tablet_ui_mode), - entries = TabletUiMode.entries.associateWith { localize(it.titleRes) }, + title = stringResource(MR.strings.pref_tablet_ui_mode), + entries = TabletUiMode.entries.associateWith { stringResource(it.titleRes) }, onValueChanged = { context.toast(MR.strings.requires_app_restart) true @@ -162,19 +162,19 @@ object SettingsAppearanceScreen : SearchableSettings { ), Preference.PreferenceItem.ListPreference( pref = uiPreferences.dateFormat(), - title = localize(MR.strings.pref_date_format), + title = stringResource(MR.strings.pref_date_format), entries = DateFormats .associateWith { 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( pref = uiPreferences.relativeTime(), - title = localize(MR.strings.pref_relative_format), - subtitle = localize( + title = stringResource(MR.strings.pref_relative_format), + subtitle = stringResource( MR.strings.pref_relative_format_summary, - localize(MR.strings.relative_time_today), + stringResource(MR.strings.relative_time_today), formattedNow, ), ), @@ -201,7 +201,7 @@ object SettingsAppearanceScreen : SearchableSettings { } 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() } diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsBrowseScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsBrowseScreen.kt index d5390ddb8d..4d9aa2796a 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsBrowseScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsBrowseScreen.kt @@ -8,9 +8,9 @@ import androidx.fragment.app.FragmentActivity import eu.kanade.domain.source.service.SourcePreferences import eu.kanade.presentation.more.settings.Preference import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.authenticate -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 import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get @@ -26,28 +26,28 @@ object SettingsBrowseScreen : SearchableSettings { val sourcePreferences = remember { Injekt.get() } return listOf( Preference.PreferenceGroup( - title = localize(MR.strings.label_sources), + title = stringResource(MR.strings.label_sources), preferenceItems = listOf( Preference.PreferenceItem.SwitchPreference( pref = sourcePreferences.hideInLibraryItems(), - title = localize(MR.strings.pref_hide_in_library_items), + title = stringResource(MR.strings.pref_hide_in_library_items), ), ), ), Preference.PreferenceGroup( - title = localize(MR.strings.pref_category_nsfw_content), + title = stringResource(MR.strings.pref_category_nsfw_content), preferenceItems = listOf( Preference.PreferenceItem.SwitchPreference( pref = sourcePreferences.showNsfwSource(), - title = localize(MR.strings.pref_show_nsfw_source), - subtitle = localize(MR.strings.requires_app_restart), + title = stringResource(MR.strings.pref_show_nsfw_source), + subtitle = stringResource(MR.strings.requires_app_restart), onValueChanged = { (context as FragmentActivity).authenticate( - title = context.localize(MR.strings.pref_category_nsfw_content), + title = context.stringResource(MR.strings.pref_category_nsfw_content), ) }, ), - Preference.PreferenceItem.InfoPreference(localize(MR.strings.parental_controls_info)), + Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.parental_controls_info)), ), ), ) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt index 49b42931e3..f2c2c05563 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt @@ -43,14 +43,14 @@ import eu.kanade.tachiyomi.util.system.DeviceUtil import eu.kanade.tachiyomi.util.system.copyToClipboard import eu.kanade.tachiyomi.util.system.toast import logcat.LogPriority -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.core.util.lang.launchNonCancellable import tachiyomi.core.util.lang.withUIContext import tachiyomi.core.util.system.logcat import tachiyomi.domain.backup.service.BackupPreferences import tachiyomi.domain.library.service.LibraryPreferences import tachiyomi.i18n.MR -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 @@ -81,7 +81,7 @@ object SettingsDataScreen : SearchableSettings { val lastAutoBackup by backupPreferences.lastAutoBackupTimestamp().collectAsState() return Preference.PreferenceGroup( - title = localize(MR.strings.label_backup), + title = stringResource(MR.strings.label_backup), preferenceItems = listOf( // Manual actions getCreateBackupPref(), @@ -90,14 +90,14 @@ object SettingsDataScreen : SearchableSettings { // Automatic backups Preference.PreferenceItem.ListPreference( pref = backupIntervalPref, - title = localize(MR.strings.pref_backup_interval), + title = stringResource(MR.strings.pref_backup_interval), entries = mapOf( - 0 to localize(MR.strings.off), - 6 to localize(MR.strings.update_6hour), - 12 to localize(MR.strings.update_12hour), - 24 to localize(MR.strings.update_24hour), - 48 to localize(MR.strings.update_48hour), - 168 to localize(MR.strings.update_weekly), + 0 to stringResource(MR.strings.off), + 6 to stringResource(MR.strings.update_6hour), + 12 to stringResource(MR.strings.update_12hour), + 24 to stringResource(MR.strings.update_24hour), + 48 to stringResource(MR.strings.update_48hour), + 168 to stringResource(MR.strings.update_weekly), ), onValueChanged = { BackupCreateJob.setupTask(context, it) @@ -107,12 +107,12 @@ object SettingsDataScreen : SearchableSettings { Preference.PreferenceItem.ListPreference( pref = backupPreferences.numberOfBackups(), 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() }, ), Preference.PreferenceItem.InfoPreference( - localize(MR.strings.backup_info) + "\n\n" + - localize(MR.strings.last_auto_backup_info, relativeTimeSpanString(lastAutoBackup)), + stringResource(MR.strings.backup_info) + "\n\n" + + stringResource(MR.strings.last_auto_backup_info, relativeTimeSpanString(lastAutoBackup)), ), ), ) @@ -122,8 +122,8 @@ object SettingsDataScreen : SearchableSettings { private fun getCreateBackupPref(): Preference.PreferenceItem.TextPreference { val navigator = LocalNavigator.currentOrThrow return Preference.PreferenceItem.TextPreference( - title = localize(MR.strings.pref_create_backup), - subtitle = localize(MR.strings.pref_create_backup_summ), + title = stringResource(MR.strings.pref_create_backup), + subtitle = stringResource(MR.strings.pref_create_backup_summ), onClick = { navigator.push(CreateBackupScreen()) }, ) } @@ -138,7 +138,7 @@ object SettingsDataScreen : SearchableSettings { is InvalidRestore -> { AlertDialog( 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")) }, dismissButton = { TextButton( @@ -147,12 +147,12 @@ object SettingsDataScreen : SearchableSettings { onDismissRequest() }, ) { - Text(text = localize(MR.strings.action_copy_to_clipboard)) + Text(text = stringResource(MR.strings.action_copy_to_clipboard)) } }, confirmButton = { TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_ok)) + Text(text = stringResource(MR.strings.action_ok)) } }, ) @@ -160,15 +160,15 @@ object SettingsDataScreen : SearchableSettings { is MissingRestoreComponents -> { AlertDialog( onDismissRequest = onDismissRequest, - title = { Text(text = localize(MR.strings.pref_restore_backup)) }, + title = { Text(text = stringResource(MR.strings.pref_restore_backup)) }, text = { Column( modifier = Modifier.verticalScroll(rememberScrollState()), ) { val msg = buildString { - append(localize(MR.strings.backup_restore_content_full)) + append(stringResource(MR.strings.backup_restore_content_full)) 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( this, separator = "\n- ", @@ -176,7 +176,9 @@ object SettingsDataScreen : SearchableSettings { ) } 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( this, separator = "\n- ", @@ -194,7 +196,7 @@ object SettingsDataScreen : SearchableSettings { onDismissRequest() }, ) { - Text(text = localize(MR.strings.action_restore)) + Text(text = stringResource(MR.strings.action_restore)) } }, ) @@ -207,7 +209,7 @@ object SettingsDataScreen : SearchableSettings { object : ActivityResultContracts.GetContent() { override fun createIntent(context: Context, input: String): Intent { 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)) } }, ) { @@ -232,8 +234,8 @@ object SettingsDataScreen : SearchableSettings { } return Preference.PreferenceItem.TextPreference( - title = localize(MR.strings.pref_restore_backup), - subtitle = localize(MR.strings.pref_restore_backup_summ), + title = stringResource(MR.strings.pref_restore_backup), + subtitle = stringResource(MR.strings.pref_restore_backup_summ), onClick = { if (!BackupRestoreJob.isRunning(context)) { if (DeviceUtil.isMiui && DeviceUtil.isMiuiOptimizationDisabled()) { @@ -259,19 +261,19 @@ object SettingsDataScreen : SearchableSettings { val cacheReadableSize = remember(cacheReadableSizeSema) { chapterCache.readableSize } return Preference.PreferenceGroup( - title = localize(MR.strings.label_data), + title = stringResource(MR.strings.label_data), preferenceItems = listOf( getStorageInfoPref(cacheReadableSize), Preference.PreferenceItem.TextPreference( - title = localize(MR.strings.pref_clear_chapter_cache), - subtitle = localize(MR.strings.used_cache, cacheReadableSize), + title = stringResource(MR.strings.pref_clear_chapter_cache), + subtitle = stringResource(MR.strings.used_cache, cacheReadableSize), onClick = { scope.launchNonCancellable { try { val deletedFiles = chapterCache.clear() withUIContext { - context.toast(context.localize(MR.strings.cache_deleted, deletedFiles)) + context.toast(context.stringResource(MR.strings.cache_deleted, deletedFiles)) cacheReadableSizeSema++ } } catch (e: Throwable) { @@ -283,7 +285,7 @@ object SettingsDataScreen : SearchableSettings { ), Preference.PreferenceItem.SwitchPreference( pref = libraryPreferences.autoClearChapterCache(), - title = localize(MR.strings.pref_auto_clear_chapter_cache), + title = stringResource(MR.strings.pref_auto_clear_chapter_cache), ), ), ) @@ -302,10 +304,10 @@ object SettingsDataScreen : SearchableSettings { } return Preference.PreferenceItem.CustomPreference( - title = localize(MR.strings.pref_storage_usage), + title = stringResource(MR.strings.pref_storage_usage), ) { BasePreferenceWidget( - title = localize(MR.strings.pref_storage_usage), + title = stringResource(MR.strings.pref_storage_usage), subcomponent = { // TODO: downloads, SD cards, bar representation?, i18n Box(modifier = Modifier.padding(horizontal = PrefsHorizontalPadding)) { diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDownloadScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDownloadScreen.kt index 888e47681f..9fb1e829b7 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDownloadScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDownloadScreen.kt @@ -24,8 +24,8 @@ import tachiyomi.domain.category.interactor.GetCategories import tachiyomi.domain.category.model.Category import tachiyomi.domain.download.service.DownloadPreferences import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize -import tachiyomi.presentation.core.i18n.localizePlural +import tachiyomi.presentation.core.i18n.pluralStringResource +import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.util.collectAsState import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get @@ -47,16 +47,16 @@ object SettingsDownloadScreen : SearchableSettings { getDownloadLocationPreference(downloadPreferences = downloadPreferences), Preference.PreferenceItem.SwitchPreference( pref = downloadPreferences.downloadOnlyOverWifi(), - title = localize(MR.strings.connected_to_wifi), + title = stringResource(MR.strings.connected_to_wifi), ), Preference.PreferenceItem.SwitchPreference( pref = downloadPreferences.saveChaptersAsCBZ(), - title = localize(MR.strings.save_chapter_as_cbz), + title = stringResource(MR.strings.save_chapter_as_cbz), ), Preference.PreferenceItem.SwitchPreference( pref = downloadPreferences.splitTallImages(), - title = localize(MR.strings.split_tall_images), - subtitle = localize(MR.strings.split_tall_images_summary), + title = stringResource(MR.strings.split_tall_images), + subtitle = stringResource(MR.strings.split_tall_images_summary), ), getDeleteChaptersGroup( downloadPreferences = downloadPreferences, @@ -97,15 +97,15 @@ object SettingsDownloadScreen : SearchableSettings { return Preference.PreferenceItem.ListPreference( pref = currentDirPref, - title = localize(MR.strings.pref_download_directory), + title = stringResource(MR.strings.pref_download_directory), subtitleProvider = { value, _ -> remember(value) { UniFile.fromUri(context, value.toUri())?.filePath - } ?: localize(MR.strings.invalid_location, value) + } ?: stringResource(MR.strings.invalid_location, value) }, entries = mapOf( defaultDirPair, - customDirEntryKey to localize(MR.strings.custom_dir), + customDirEntryKey to stringResource(MR.strings.custom_dir), ), onValueChanged = { val default = it == defaultDirPair.first @@ -119,7 +119,7 @@ object SettingsDownloadScreen : SearchableSettings { @Composable private fun rememberDefaultDownloadDir(): Pair { - val appName = localize(MR.strings.app_name) + val appName = stringResource(MR.strings.app_name) return remember { val file = UniFile.fromFile( File( @@ -137,27 +137,27 @@ object SettingsDownloadScreen : SearchableSettings { categories: List, ): Preference.PreferenceGroup { return Preference.PreferenceGroup( - title = localize(MR.strings.pref_category_delete_chapters), + title = stringResource(MR.strings.pref_category_delete_chapters), preferenceItems = listOf( Preference.PreferenceItem.SwitchPreference( 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( pref = downloadPreferences.removeAfterReadSlots(), - title = localize(MR.strings.pref_remove_after_read), + title = stringResource(MR.strings.pref_remove_after_read), entries = mapOf( - -1 to localize(MR.strings.disabled), - 0 to localize(MR.strings.last_read_chapter), - 1 to localize(MR.strings.second_to_last), - 2 to localize(MR.strings.third_to_last), - 3 to localize(MR.strings.fourth_to_last), - 4 to localize(MR.strings.fifth_to_last), + -1 to stringResource(MR.strings.disabled), + 0 to stringResource(MR.strings.last_read_chapter), + 1 to stringResource(MR.strings.second_to_last), + 2 to stringResource(MR.strings.third_to_last), + 3 to stringResource(MR.strings.fourth_to_last), + 4 to stringResource(MR.strings.fifth_to_last), ), ), Preference.PreferenceItem.SwitchPreference( pref = downloadPreferences.removeBookmarkedChapters(), - title = localize(MR.strings.pref_remove_bookmarked_chapters), + title = stringResource(MR.strings.pref_remove_bookmarked_chapters), ), getExcludedCategoriesPreference( downloadPreferences = downloadPreferences, @@ -174,7 +174,7 @@ object SettingsDownloadScreen : SearchableSettings { ): Preference.PreferenceItem.MultiSelectListPreference { return Preference.PreferenceItem.MultiSelectListPreference( 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 }, ) } @@ -195,8 +195,8 @@ object SettingsDownloadScreen : SearchableSettings { var showDialog by rememberSaveable { mutableStateOf(false) } if (showDialog) { TriStateListDialog( - title = localize(MR.strings.categories), - message = localize(MR.strings.pref_download_new_categories_details), + title = stringResource(MR.strings.categories), + message = stringResource(MR.strings.pref_download_new_categories_details), items = allCategories, initialChecked = included.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( - title = localize(MR.strings.pref_category_auto_download), + title = stringResource(MR.strings.pref_category_auto_download), preferenceItems = listOf( Preference.PreferenceItem.SwitchPreference( pref = downloadNewChaptersPref, - title = localize(MR.strings.pref_download_new), + title = stringResource(MR.strings.pref_download_new), ), Preference.PreferenceItem.TextPreference( - title = localize(MR.strings.categories), + title = stringResource(MR.strings.categories), subtitle = getCategoriesLabel( allCategories = allCategories, included = included, @@ -236,20 +236,20 @@ object SettingsDownloadScreen : SearchableSettings { downloadPreferences: DownloadPreferences, ): Preference.PreferenceGroup { return Preference.PreferenceGroup( - title = localize(MR.strings.download_ahead), + title = stringResource(MR.strings.download_ahead), preferenceItems = listOf( Preference.PreferenceItem.ListPreference( 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 { if (it == 0) { - localize(MR.strings.disabled) + stringResource(MR.strings.disabled) } 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)), ), ) } diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt index db81e7bc58..564b0b647a 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt @@ -34,8 +34,8 @@ import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_NON_C import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_NON_READ import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_OUTSIDE_RELEASE_PERIOD import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize -import tachiyomi.presentation.core.i18n.localizePlural +import tachiyomi.presentation.core.i18n.pluralStringResource +import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.util.collectAsState import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get @@ -75,15 +75,15 @@ object SettingsLibraryScreen : SearchableSettings { // For default category val ids = listOf(libraryPreferences.defaultCategory().defaultValue()) + allCategories.fastMap { it.id.toInt() } - val labels = listOf(localize(MR.strings.default_category_summary)) + + val labels = listOf(stringResource(MR.strings.default_category_summary)) + allCategories.fastMap { it.visualName(context) } return Preference.PreferenceGroup( - title = localize(MR.strings.categories), + title = stringResource(MR.strings.categories), preferenceItems = listOf( Preference.PreferenceItem.TextPreference( - title = localize(MR.strings.action_edit_categories), - subtitle = localizePlural( + title = stringResource(MR.strings.action_edit_categories), + subtitle = pluralStringResource( MR.plurals.num_categories, count = userCategoriesCount, userCategoriesCount, @@ -92,13 +92,13 @@ object SettingsLibraryScreen : SearchableSettings { ), Preference.PreferenceItem.ListPreference( pref = libraryPreferences.defaultCategory(), - title = localize(MR.strings.default_category), - subtitle = selectedCategory?.visualName ?: localize(MR.strings.default_category_summary), + title = stringResource(MR.strings.default_category), + subtitle = selectedCategory?.visualName ?: stringResource(MR.strings.default_category_summary), entries = ids.zip(labels).toMap(), ), Preference.PreferenceItem.SwitchPreference( pref = libraryPreferences.categorizedDisplaySettings(), - title = localize(MR.strings.categorized_display_settings), + title = stringResource(MR.strings.categorized_display_settings), onValueChanged = { if (!it) { scope.launch { @@ -130,8 +130,8 @@ object SettingsLibraryScreen : SearchableSettings { var showCategoriesDialog by rememberSaveable { mutableStateOf(false) } if (showCategoriesDialog) { TriStateListDialog( - title = localize(MR.strings.categories), - message = localize(MR.strings.pref_library_update_categories_details), + title = stringResource(MR.strings.categories), + message = stringResource(MR.strings.pref_library_update_categories_details), items = allCategories, initialChecked = included.mapNotNull { id -> allCategories.find { it.id.toString() == id } }, initialInversed = excluded.mapNotNull { id -> allCategories.find { it.id.toString() == id } }, @@ -146,18 +146,18 @@ object SettingsLibraryScreen : SearchableSettings { } return Preference.PreferenceGroup( - title = localize(MR.strings.pref_category_library_update), + title = stringResource(MR.strings.pref_category_library_update), preferenceItems = listOf( Preference.PreferenceItem.ListPreference( pref = autoUpdateIntervalPref, - title = localize(MR.strings.pref_library_update_interval), + title = stringResource(MR.strings.pref_library_update_interval), entries = mapOf( - 0 to localize(MR.strings.update_never), - 12 to localize(MR.strings.update_12hour), - 24 to localize(MR.strings.update_24hour), - 48 to localize(MR.strings.update_48hour), - 72 to localize(MR.strings.update_72hour), - 168 to localize(MR.strings.update_weekly), + 0 to stringResource(MR.strings.update_never), + 12 to stringResource(MR.strings.update_12hour), + 24 to stringResource(MR.strings.update_24hour), + 48 to stringResource(MR.strings.update_48hour), + 72 to stringResource(MR.strings.update_72hour), + 168 to stringResource(MR.strings.update_weekly), ), onValueChanged = { LibraryUpdateJob.setupTask(context, it) @@ -167,12 +167,12 @@ object SettingsLibraryScreen : SearchableSettings { Preference.PreferenceItem.MultiSelectListPreference( pref = libraryPreferences.autoUpdateDeviceRestrictions(), enabled = autoUpdateInterval > 0, - title = localize(MR.strings.pref_library_update_restriction), - subtitle = localize(MR.strings.restrictions), + title = stringResource(MR.strings.pref_library_update_restriction), + subtitle = stringResource(MR.strings.restrictions), entries = mapOf( - DEVICE_ONLY_ON_WIFI to localize(MR.strings.connected_to_wifi), - DEVICE_NETWORK_NOT_METERED to localize(MR.strings.network_not_metered), - DEVICE_CHARGING to localize(MR.strings.charging), + DEVICE_ONLY_ON_WIFI to stringResource(MR.strings.connected_to_wifi), + DEVICE_NETWORK_NOT_METERED to stringResource(MR.strings.network_not_metered), + DEVICE_CHARGING to stringResource(MR.strings.charging), ), onValueChanged = { // Post to event looper to allow the preference to be updated. @@ -181,7 +181,7 @@ object SettingsLibraryScreen : SearchableSettings { }, ), Preference.PreferenceItem.TextPreference( - title = localize(MR.strings.categories), + title = stringResource(MR.strings.categories), subtitle = getCategoriesLabel( allCategories = allCategories, included = included, @@ -191,22 +191,22 @@ object SettingsLibraryScreen : SearchableSettings { ), Preference.PreferenceItem.SwitchPreference( pref = libraryPreferences.autoUpdateMetadata(), - title = localize(MR.strings.pref_library_update_refresh_metadata), - subtitle = localize(MR.strings.pref_library_update_refresh_metadata_summary), + title = stringResource(MR.strings.pref_library_update_refresh_metadata), + subtitle = stringResource(MR.strings.pref_library_update_refresh_metadata_summary), ), Preference.PreferenceItem.MultiSelectListPreference( pref = libraryPreferences.autoUpdateMangaRestrictions(), - title = localize(MR.strings.pref_library_update_manga_restriction), + title = stringResource(MR.strings.pref_library_update_manga_restriction), entries = mapOf( - MANGA_HAS_UNREAD to localize(MR.strings.pref_update_only_completely_read), - MANGA_NON_READ to localize(MR.strings.pref_update_only_started), - MANGA_NON_COMPLETED to localize(MR.strings.pref_update_only_non_completed), - MANGA_OUTSIDE_RELEASE_PERIOD to localize(MR.strings.pref_update_only_in_release_period), + MANGA_HAS_UNREAD to stringResource(MR.strings.pref_update_only_completely_read), + MANGA_NON_READ to stringResource(MR.strings.pref_update_only_started), + MANGA_NON_COMPLETED to stringResource(MR.strings.pref_update_only_non_completed), + MANGA_OUTSIDE_RELEASE_PERIOD to stringResource(MR.strings.pref_update_only_in_release_period), ), ), Preference.PreferenceItem.SwitchPreference( pref = libraryPreferences.newShowUpdatesCount(), - title = localize(MR.strings.pref_library_update_show_tab_badge), + title = stringResource(MR.strings.pref_library_update_show_tab_badge), ), ), ) @@ -217,34 +217,34 @@ object SettingsLibraryScreen : SearchableSettings { libraryPreferences: LibraryPreferences, ): Preference.PreferenceGroup { return Preference.PreferenceGroup( - title = localize(MR.strings.pref_chapter_swipe), + title = stringResource(MR.strings.pref_chapter_swipe), preferenceItems = listOf( Preference.PreferenceItem.ListPreference( pref = libraryPreferences.swipeToStartAction(), - title = localize(MR.strings.pref_chapter_swipe_start), + title = stringResource(MR.strings.pref_chapter_swipe_start), entries = mapOf( LibraryPreferences.ChapterSwipeAction.Disabled to - localize(MR.strings.disabled), + stringResource(MR.strings.disabled), LibraryPreferences.ChapterSwipeAction.ToggleBookmark to - localize(MR.strings.action_bookmark), + stringResource(MR.strings.action_bookmark), LibraryPreferences.ChapterSwipeAction.ToggleRead to - localize(MR.strings.action_mark_as_read), + stringResource(MR.strings.action_mark_as_read), LibraryPreferences.ChapterSwipeAction.Download to - localize(MR.strings.action_download), + stringResource(MR.strings.action_download), ), ), Preference.PreferenceItem.ListPreference( pref = libraryPreferences.swipeToEndAction(), - title = localize(MR.strings.pref_chapter_swipe_end), + title = stringResource(MR.strings.pref_chapter_swipe_end), entries = mapOf( LibraryPreferences.ChapterSwipeAction.Disabled to - localize(MR.strings.disabled), + stringResource(MR.strings.disabled), LibraryPreferences.ChapterSwipeAction.ToggleBookmark to - localize(MR.strings.action_bookmark), + stringResource(MR.strings.action_bookmark), LibraryPreferences.ChapterSwipeAction.ToggleRead to - localize(MR.strings.action_mark_as_read), + stringResource(MR.strings.action_mark_as_read), LibraryPreferences.ChapterSwipeAction.Download to - localize(MR.strings.action_download), + stringResource(MR.strings.action_download), ), ), ), diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsMainScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsMainScreen.kt index d832331c81..cfb010e599 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsMainScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsMainScreen.kt @@ -47,7 +47,7 @@ import eu.kanade.presentation.util.Screen import kotlinx.collections.immutable.persistentListOf import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.Scaffold -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import cafe.adriel.voyager.core.screen.Screen as VoyagerScreen object SettingsMainScreen : Screen() { @@ -84,13 +84,13 @@ object SettingsMainScreen : Screen() { topBarScrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(topBarState), topBar = { scrollBehavior -> AppBar( - title = localize(MR.strings.label_settings), + title = stringResource(MR.strings.label_settings), navigateUp = backPress::invoke, actions = { AppBarActions( persistentListOf( AppBar.Action( - title = localize(MR.strings.action_search), + title = stringResource(MR.strings.action_search), icon = Icons.Outlined.Search, onClick = { navigator.navigate(SettingsSearchScreen(), twoPane) }, ), @@ -147,7 +147,7 @@ object SettingsMainScreen : Screen() { CompositionLocalProvider(LocalContentColor provides contentColor) { TextPreferenceWidget( modifier = modifier, - title = localize(item.titleRes), + title = stringResource(item.titleRes), subtitle = item.formatSubtitle(), icon = item.icon, onPreferenceClick = { navigator.navigate(item.screen, twoPane) }, @@ -166,7 +166,7 @@ object SettingsMainScreen : Screen() { private data class Item( val titleRes: StringResource, val subtitleRes: StringResource? = null, - val formatSubtitle: @Composable () -> String? = { subtitleRes?.let { localize(it) } }, + val formatSubtitle: @Composable () -> String? = { subtitleRes?.let { stringResource(it) } }, val icon: ImageVector, val screen: VoyagerScreen, ) @@ -229,7 +229,7 @@ object SettingsMainScreen : Screen() { Item( titleRes = MR.strings.pref_category_about, formatSubtitle = { - "${localize(MR.strings.app_name)} ${AboutScreen.getVersionName(withBuildDate = false)}" + "${stringResource(MR.strings.app_name)} ${AboutScreen.getVersionName(withBuildDate = false)}" }, icon = Icons.Outlined.Info, screen = AboutScreen, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt index c5b8a0018f..0e254d8a66 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt @@ -11,7 +11,7 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderOrientation import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode import tachiyomi.i18n.MR -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 @@ -29,43 +29,43 @@ object SettingsReaderScreen : SearchableSettings { return listOf( Preference.PreferenceItem.ListPreference( pref = readerPref.defaultReadingMode(), - title = localize(MR.strings.pref_viewer_type), + title = stringResource(MR.strings.pref_viewer_type), entries = ReadingMode.entries.drop(1) - .associate { it.flagValue to localize(it.stringRes) }, + .associate { it.flagValue to stringResource(it.stringRes) }, ), Preference.PreferenceItem.ListPreference( pref = readerPref.doubleTapAnimSpeed(), - title = localize(MR.strings.pref_double_tap_anim_speed), + title = stringResource(MR.strings.pref_double_tap_anim_speed), entries = mapOf( - 1 to localize(MR.strings.double_tap_anim_speed_0), - 500 to localize(MR.strings.double_tap_anim_speed_normal), - 250 to localize(MR.strings.double_tap_anim_speed_fast), + 1 to stringResource(MR.strings.double_tap_anim_speed_0), + 500 to stringResource(MR.strings.double_tap_anim_speed_normal), + 250 to stringResource(MR.strings.double_tap_anim_speed_fast), ), ), Preference.PreferenceItem.SwitchPreference( pref = readerPref.showReadingMode(), - title = localize(MR.strings.pref_show_reading_mode), - subtitle = localize(MR.strings.pref_show_reading_mode_summary), + title = stringResource(MR.strings.pref_show_reading_mode), + subtitle = stringResource(MR.strings.pref_show_reading_mode_summary), ), Preference.PreferenceItem.SwitchPreference( pref = readerPref.showNavigationOverlayOnStart(), - title = localize(MR.strings.pref_show_navigation_mode), - subtitle = localize(MR.strings.pref_show_navigation_mode_summary), + title = stringResource(MR.strings.pref_show_navigation_mode), + subtitle = stringResource(MR.strings.pref_show_navigation_mode_summary), ), Preference.PreferenceItem.SwitchPreference( pref = readerPref.trueColor(), - title = localize(MR.strings.pref_true_color), - subtitle = localize(MR.strings.pref_true_color_summary), + title = stringResource(MR.strings.pref_true_color), + subtitle = stringResource(MR.strings.pref_true_color_summary), enabled = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O, ), Preference.PreferenceItem.SwitchPreference( pref = readerPref.pageTransitions(), - title = localize(MR.strings.pref_page_transitions), + title = stringResource(MR.strings.pref_page_transitions), ), Preference.PreferenceItem.SwitchPreference( pref = readerPref.flashOnPageChange(), - title = localize(MR.strings.pref_flash_page), - subtitle = localize(MR.strings.pref_flash_page_summ), + title = stringResource(MR.strings.pref_flash_page), + subtitle = stringResource(MR.strings.pref_flash_page_summ), ), getDisplayGroup(readerPreferences = readerPref), getReadingGroup(readerPreferences = readerPref), @@ -81,42 +81,42 @@ object SettingsReaderScreen : SearchableSettings { val fullscreenPref = readerPreferences.fullscreen() val fullscreen by fullscreenPref.collectAsState() return Preference.PreferenceGroup( - title = localize(MR.strings.pref_category_display), + title = stringResource(MR.strings.pref_category_display), preferenceItems = listOf( Preference.PreferenceItem.ListPreference( pref = readerPreferences.defaultOrientationType(), - title = localize(MR.strings.pref_rotation_type), + title = stringResource(MR.strings.pref_rotation_type), entries = ReaderOrientation.entries.drop(1) - .associate { it.flagValue to localize(it.stringRes) }, + .associate { it.flagValue to stringResource(it.stringRes) }, ), Preference.PreferenceItem.ListPreference( pref = readerPreferences.readerTheme(), - title = localize(MR.strings.pref_reader_theme), + title = stringResource(MR.strings.pref_reader_theme), entries = mapOf( - 1 to localize(MR.strings.black_background), - 2 to localize(MR.strings.gray_background), - 0 to localize(MR.strings.white_background), - 3 to localize(MR.strings.automatic_background), + 1 to stringResource(MR.strings.black_background), + 2 to stringResource(MR.strings.gray_background), + 0 to stringResource(MR.strings.white_background), + 3 to stringResource(MR.strings.automatic_background), ), ), Preference.PreferenceItem.SwitchPreference( pref = fullscreenPref, - title = localize(MR.strings.pref_fullscreen), + title = stringResource(MR.strings.pref_fullscreen), ), Preference.PreferenceItem.SwitchPreference( pref = readerPreferences.cutoutShort(), - title = localize(MR.strings.pref_cutout_short), + title = stringResource(MR.strings.pref_cutout_short), enabled = fullscreen && Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && LocalView.current.rootWindowInsets?.displayCutout != null, // has cutout ), Preference.PreferenceItem.SwitchPreference( pref = readerPreferences.keepScreenOn(), - title = localize(MR.strings.pref_keep_screen_on), + title = stringResource(MR.strings.pref_keep_screen_on), ), Preference.PreferenceItem.SwitchPreference( pref = readerPreferences.showPageNumber(), - title = localize(MR.strings.pref_show_page_number), + title = stringResource(MR.strings.pref_show_page_number), ), ), ) @@ -125,23 +125,23 @@ object SettingsReaderScreen : SearchableSettings { @Composable private fun getReadingGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup { return Preference.PreferenceGroup( - title = localize(MR.strings.pref_category_reading), + title = stringResource(MR.strings.pref_category_reading), preferenceItems = listOf( Preference.PreferenceItem.SwitchPreference( pref = readerPreferences.skipRead(), - title = localize(MR.strings.pref_skip_read_chapters), + title = stringResource(MR.strings.pref_skip_read_chapters), ), Preference.PreferenceItem.SwitchPreference( pref = readerPreferences.skipFiltered(), - title = localize(MR.strings.pref_skip_filtered_chapters), + title = stringResource(MR.strings.pref_skip_filtered_chapters), ), Preference.PreferenceItem.SwitchPreference( pref = readerPreferences.skipDupe(), - title = localize(MR.strings.pref_skip_dupe_chapters), + title = stringResource(MR.strings.pref_skip_dupe_chapters), ), Preference.PreferenceItem.SwitchPreference( pref = readerPreferences.alwaysShowChapterTransition(), - title = localize(MR.strings.pref_always_show_chapter_transition), + title = stringResource(MR.strings.pref_always_show_chapter_transition), ), ), ) @@ -160,57 +160,57 @@ object SettingsReaderScreen : SearchableSettings { val rotateToFit by rotateToFitPref.collectAsState() return Preference.PreferenceGroup( - title = localize(MR.strings.pager_viewer), + title = stringResource(MR.strings.pager_viewer), preferenceItems = listOf( Preference.PreferenceItem.ListPreference( pref = navModePref, - title = localize(MR.strings.pref_viewer_nav), + title = stringResource(MR.strings.pref_viewer_nav), entries = ReaderPreferences.TapZones - .mapIndexed { index, it -> index to localize(it) } + .mapIndexed { index, it -> index to stringResource(it) } .toMap(), ), Preference.PreferenceItem.ListPreference( pref = readerPreferences.pagerNavInverted(), - title = localize(MR.strings.pref_read_with_tapping_inverted), + title = stringResource(MR.strings.pref_read_with_tapping_inverted), entries = listOf( ReaderPreferences.TappingInvertMode.NONE, ReaderPreferences.TappingInvertMode.HORIZONTAL, ReaderPreferences.TappingInvertMode.VERTICAL, ReaderPreferences.TappingInvertMode.BOTH, - ).associateWith { localize(it.titleRes) }, + ).associateWith { stringResource(it.titleRes) }, enabled = navMode != 5, ), Preference.PreferenceItem.ListPreference( pref = imageScaleTypePref, - title = localize(MR.strings.pref_image_scale_type), + title = stringResource(MR.strings.pref_image_scale_type), entries = ReaderPreferences.ImageScaleType - .mapIndexed { index, it -> index + 1 to localize(it) } + .mapIndexed { index, it -> index + 1 to stringResource(it) } .toMap(), ), Preference.PreferenceItem.ListPreference( pref = readerPreferences.zoomStart(), - title = localize(MR.strings.pref_zoom_start), + title = stringResource(MR.strings.pref_zoom_start), entries = ReaderPreferences.ZoomStart - .mapIndexed { index, it -> index + 1 to localize(it) } + .mapIndexed { index, it -> index + 1 to stringResource(it) } .toMap(), ), Preference.PreferenceItem.SwitchPreference( pref = readerPreferences.cropBorders(), - title = localize(MR.strings.pref_crop_borders), + title = stringResource(MR.strings.pref_crop_borders), ), Preference.PreferenceItem.SwitchPreference( pref = readerPreferences.landscapeZoom(), - title = localize(MR.strings.pref_landscape_zoom), + title = stringResource(MR.strings.pref_landscape_zoom), enabled = imageScaleType == 1, ), Preference.PreferenceItem.SwitchPreference( pref = readerPreferences.navigateToPan(), - title = localize(MR.strings.pref_navigate_pan), + title = stringResource(MR.strings.pref_navigate_pan), enabled = navMode != 5, ), Preference.PreferenceItem.SwitchPreference( pref = dualPageSplitPref, - title = localize(MR.strings.pref_dual_page_split), + title = stringResource(MR.strings.pref_dual_page_split), onValueChanged = { rotateToFitPref.set(false) true @@ -218,13 +218,13 @@ object SettingsReaderScreen : SearchableSettings { ), Preference.PreferenceItem.SwitchPreference( pref = readerPreferences.dualPageInvertPaged(), - title = localize(MR.strings.pref_dual_page_invert), - subtitle = localize(MR.strings.pref_dual_page_invert_summary), + title = stringResource(MR.strings.pref_dual_page_invert), + subtitle = stringResource(MR.strings.pref_dual_page_invert_summary), enabled = dualPageSplit, ), Preference.PreferenceItem.SwitchPreference( pref = rotateToFitPref, - title = localize(MR.strings.pref_page_rotate), + title = stringResource(MR.strings.pref_page_rotate), onValueChanged = { dualPageSplitPref.set(false) true @@ -232,7 +232,7 @@ object SettingsReaderScreen : SearchableSettings { ), Preference.PreferenceItem.SwitchPreference( pref = readerPreferences.dualPageRotateToFitInvert(), - title = localize(MR.strings.pref_page_rotate_invert), + title = stringResource(MR.strings.pref_page_rotate_invert), enabled = rotateToFit, ), ), @@ -252,29 +252,29 @@ object SettingsReaderScreen : SearchableSettings { val webtoonSidePadding by webtoonSidePaddingPref.collectAsState() return Preference.PreferenceGroup( - title = localize(MR.strings.webtoon_viewer), + title = stringResource(MR.strings.webtoon_viewer), preferenceItems = listOf( Preference.PreferenceItem.ListPreference( pref = navModePref, - title = localize(MR.strings.pref_viewer_nav), + title = stringResource(MR.strings.pref_viewer_nav), entries = ReaderPreferences.TapZones - .mapIndexed { index, it -> index to localize(it) } + .mapIndexed { index, it -> index to stringResource(it) } .toMap(), ), Preference.PreferenceItem.ListPreference( pref = readerPreferences.webtoonNavInverted(), - title = localize(MR.strings.pref_read_with_tapping_inverted), + title = stringResource(MR.strings.pref_read_with_tapping_inverted), entries = listOf( ReaderPreferences.TappingInvertMode.NONE, ReaderPreferences.TappingInvertMode.HORIZONTAL, ReaderPreferences.TappingInvertMode.VERTICAL, ReaderPreferences.TappingInvertMode.BOTH, - ).associateWith { localize(it.titleRes) }, + ).associateWith { stringResource(it.titleRes) }, enabled = navMode != 5, ), Preference.PreferenceItem.SliderPreference( value = webtoonSidePadding, - title = localize(MR.strings.pref_webtoon_side_padding), + title = stringResource(MR.strings.pref_webtoon_side_padding), subtitle = numberFormat.format(webtoonSidePadding / 100f), min = ReaderPreferences.WEBTOON_PADDING_MIN, max = ReaderPreferences.WEBTOON_PADDING_MAX, @@ -285,31 +285,31 @@ object SettingsReaderScreen : SearchableSettings { ), Preference.PreferenceItem.ListPreference( pref = readerPreferences.readerHideThreshold(), - title = localize(MR.strings.pref_hide_threshold), + title = stringResource(MR.strings.pref_hide_threshold), entries = mapOf( - ReaderPreferences.ReaderHideThreshold.HIGHEST to localize(MR.strings.pref_highest), - ReaderPreferences.ReaderHideThreshold.HIGH to localize(MR.strings.pref_high), - ReaderPreferences.ReaderHideThreshold.LOW to localize(MR.strings.pref_low), - ReaderPreferences.ReaderHideThreshold.LOWEST to localize(MR.strings.pref_lowest), + ReaderPreferences.ReaderHideThreshold.HIGHEST to stringResource(MR.strings.pref_highest), + ReaderPreferences.ReaderHideThreshold.HIGH to stringResource(MR.strings.pref_high), + ReaderPreferences.ReaderHideThreshold.LOW to stringResource(MR.strings.pref_low), + ReaderPreferences.ReaderHideThreshold.LOWEST to stringResource(MR.strings.pref_lowest), ), ), Preference.PreferenceItem.SwitchPreference( pref = readerPreferences.cropBordersWebtoon(), - title = localize(MR.strings.pref_crop_borders), + title = stringResource(MR.strings.pref_crop_borders), ), Preference.PreferenceItem.SwitchPreference( pref = dualPageSplitPref, - title = localize(MR.strings.pref_dual_page_split), + title = stringResource(MR.strings.pref_dual_page_split), ), Preference.PreferenceItem.SwitchPreference( pref = readerPreferences.dualPageInvertWebtoon(), - title = localize(MR.strings.pref_dual_page_invert), - subtitle = localize(MR.strings.pref_dual_page_invert_summary), + title = stringResource(MR.strings.pref_dual_page_invert), + subtitle = stringResource(MR.strings.pref_dual_page_invert_summary), enabled = dualPageSplit, ), Preference.PreferenceItem.SwitchPreference( pref = readerPreferences.webtoonDoubleTapZoomEnabled(), - title = localize(MR.strings.pref_double_tap_zoom), + title = stringResource(MR.strings.pref_double_tap_zoom), enabled = true, ), ), @@ -321,15 +321,15 @@ object SettingsReaderScreen : SearchableSettings { val readWithVolumeKeysPref = readerPreferences.readWithVolumeKeys() val readWithVolumeKeys by readWithVolumeKeysPref.collectAsState() return Preference.PreferenceGroup( - title = localize(MR.strings.pref_reader_navigation), + title = stringResource(MR.strings.pref_reader_navigation), preferenceItems = listOf( Preference.PreferenceItem.SwitchPreference( pref = readWithVolumeKeysPref, - title = localize(MR.strings.pref_read_with_volume_keys), + title = stringResource(MR.strings.pref_read_with_volume_keys), ), Preference.PreferenceItem.SwitchPreference( pref = readerPreferences.readWithVolumeKeysInverted(), - title = localize(MR.strings.pref_read_with_volume_keys_inverted), + title = stringResource(MR.strings.pref_read_with_volume_keys_inverted), enabled = readWithVolumeKeys, ), ), @@ -339,16 +339,16 @@ object SettingsReaderScreen : SearchableSettings { @Composable private fun getActionsGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup { return Preference.PreferenceGroup( - title = localize(MR.strings.pref_reader_actions), + title = stringResource(MR.strings.pref_reader_actions), preferenceItems = listOf( Preference.PreferenceItem.SwitchPreference( pref = readerPreferences.readWithLongTap(), - title = localize(MR.strings.pref_read_with_long_tap), + title = stringResource(MR.strings.pref_read_with_long_tap), ), Preference.PreferenceItem.SwitchPreference( pref = readerPreferences.folderPerManga(), - title = localize(MR.strings.pref_create_folder_per_manga), - subtitle = localize(MR.strings.pref_create_folder_per_manga_summary), + title = stringResource(MR.strings.pref_create_folder_per_manga), + subtitle = stringResource(MR.strings.pref_create_folder_per_manga_summary), ), ), ) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsSearchScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsSearchScreen.kt index d92c8bb484..a173effc0b 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsSearchScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsSearchScreen.kt @@ -54,7 +54,7 @@ import eu.kanade.presentation.more.settings.Preference 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.EmptyScreen import tachiyomi.presentation.core.util.runOnEnterKeyPressed import cafe.adriel.voyager.core.screen.Screen as VoyagerScreen @@ -118,7 +118,7 @@ class SettingsSearchScreen : Screen() { decorationBox = { if (textFieldValue.text.isEmpty()) { Text( - text = localize(MR.strings.action_search_settings), + text = stringResource(MR.strings.action_search_settings), color = MaterialTheme.colorScheme.onSurfaceVariant, style = MaterialTheme.typography.bodyLarge, ) @@ -222,7 +222,7 @@ private fun SearchResult( when { it == null -> {} it.isEmpty() -> { - EmptyScreen(localize(MR.strings.no_results_found)) + EmptyScreen(stringResource(MR.strings.no_results_found)) } else -> { LazyColumn( @@ -268,7 +268,7 @@ private fun SearchResult( private fun getIndex() = settingScreens .map { screen -> SettingsData( - title = localize(screen.getTitleRes()), + title = stringResource(screen.getTitleRes()), route = screen, contents = screen.getPreferences(), ) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsSecurityScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsSecurityScreen.kt index e4abad1e19..0acb22083b 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsSecurityScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsSecurityScreen.kt @@ -10,10 +10,10 @@ import eu.kanade.presentation.more.settings.Preference import eu.kanade.tachiyomi.core.security.SecurityPreferences import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.authenticate import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.isAuthenticationSupported -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.localizePlural +import tachiyomi.presentation.core.i18n.pluralStringResource +import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.util.collectAsState import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get @@ -36,43 +36,43 @@ object SettingsSecurityScreen : SearchableSettings { return listOf( Preference.PreferenceItem.SwitchPreference( pref = useAuthPref, - title = localize(MR.strings.lock_with_biometrics), + title = stringResource(MR.strings.lock_with_biometrics), enabled = authSupported, onValueChanged = { (context as FragmentActivity).authenticate( - title = context.localize(MR.strings.lock_with_biometrics), + title = context.stringResource(MR.strings.lock_with_biometrics), ) }, ), Preference.PreferenceItem.ListPreference( pref = securityPreferences.lockAppAfter(), - title = localize(MR.strings.lock_when_idle), + title = stringResource(MR.strings.lock_when_idle), enabled = authSupported && useAuth, entries = LockAfterValues .associateWith { when (it) { - -1 -> localize(MR.strings.lock_never) - 0 -> localize(MR.strings.lock_always) - else -> localizePlural(MR.plurals.lock_after_mins, count = it, it) + -1 -> stringResource(MR.strings.lock_never) + 0 -> stringResource(MR.strings.lock_always) + else -> pluralStringResource(MR.plurals.lock_after_mins, count = it, it) } }, onValueChanged = { (context as FragmentActivity).authenticate( - title = context.localize(MR.strings.lock_when_idle), + title = context.stringResource(MR.strings.lock_when_idle), ) }, ), Preference.PreferenceItem.SwitchPreference( pref = securityPreferences.hideNotificationContent(), - title = localize(MR.strings.hide_notification_content), + title = stringResource(MR.strings.hide_notification_content), ), Preference.PreferenceItem.ListPreference( pref = securityPreferences.secureScreen(), - title = localize(MR.strings.secure_screen), + title = stringResource(MR.strings.secure_screen), entries = SecurityPreferences.SecureScreenMode.entries - .associateWith { localize(it.titleRes) }, + .associateWith { stringResource(it.titleRes) }, ), - Preference.PreferenceItem.InfoPreference(localize(MR.strings.secure_screen_summary)), + Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.secure_screen_summary)), ) } } diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsTrackingScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsTrackingScreen.kt index 0762701503..4aa7a26bde 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsTrackingScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsTrackingScreen.kt @@ -56,7 +56,7 @@ import tachiyomi.core.util.lang.withUIContext import tachiyomi.domain.source.service.SourceManager import tachiyomi.i18n.MR 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 @@ -72,7 +72,7 @@ object SettingsTrackingScreen : SearchableSettings { IconButton(onClick = { uriHandler.openUri("https://tachiyomi.org/docs/guides/tracking") }) { Icon( 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() 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()) { - val missingSourcesInfo = localize( + val missingSourcesInfo = stringResource( MR.strings.enhanced_services_not_installed, enhancedTrackers.second.joinToString { it.name }, ) @@ -121,10 +121,10 @@ object SettingsTrackingScreen : SearchableSettings { return listOf( Preference.PreferenceItem.SwitchPreference( pref = trackPreferences.autoUpdateTrack(), - title = localize(MR.strings.pref_auto_update_manga_sync), + title = stringResource(MR.strings.pref_auto_update_manga_sync), ), Preference.PreferenceGroup( - title = localize(MR.strings.services), + title = stringResource(MR.strings.services), preferenceItems = listOf( Preference.PreferenceItem.TrackerPreference( title = trackerManager.myAnimeList.name, @@ -162,11 +162,11 @@ object SettingsTrackingScreen : SearchableSettings { login = { context.openInBrowser(BangumiApi.authUrl(), forceDefaultBrowser = true) }, logout = { dialog = LogoutDialog(trackerManager.bangumi) }, ), - Preference.PreferenceItem.InfoPreference(localize(MR.strings.tracking_info)), + Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.tracking_info)), ), ), Preference.PreferenceGroup( - title = localize(MR.strings.enhanced_services), + title = stringResource(MR.strings.enhanced_services), preferenceItems = enhancedTrackers.first .map { service -> Preference.PreferenceItem.TrackerPreference( @@ -199,13 +199,13 @@ object SettingsTrackingScreen : SearchableSettings { title = { Row(verticalAlignment = Alignment.CenterVertically) { Text( - text = localize(MR.strings.login_title, tracker.name), + text = stringResource(MR.strings.login_title, tracker.name), modifier = Modifier.weight(1f), ) IconButton(onClick = onDismissRequest) { Icon( 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(), value = username, onValueChange = { username = it }, - label = { Text(text = localize(uNameStringRes)) }, + label = { Text(text = stringResource(uNameStringRes)) }, keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next), singleLine = true, isError = inputError && !processing, @@ -227,7 +227,7 @@ object SettingsTrackingScreen : SearchableSettings { modifier = Modifier.fillMaxWidth(), value = password, onValueChange = { password = it }, - label = { Text(text = localize(MR.strings.password)) }, + label = { Text(text = stringResource(MR.strings.password)) }, trailingIcon = { IconButton(onClick = { hidePassword = !hidePassword }) { Icon( @@ -274,7 +274,7 @@ object SettingsTrackingScreen : SearchableSettings { }, ) { 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, title = { Text( - text = localize(MR.strings.logout_title, tracker.name), + text = stringResource(MR.strings.logout_title, tracker.name), textAlign = TextAlign.Center, modifier = Modifier.fillMaxWidth(), ) @@ -318,7 +318,7 @@ object SettingsTrackingScreen : SearchableSettings { modifier = Modifier.weight(1f), onClick = onDismissRequest, ) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } Button( modifier = Modifier.weight(1f), @@ -332,7 +332,7 @@ object SettingsTrackingScreen : SearchableSettings { contentColor = MaterialTheme.colorScheme.onError, ), ) { - Text(text = localize(MR.strings.logout)) + Text(text = stringResource(MR.strings.logout)) } } }, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/AboutScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/AboutScreen.kt index fb537fd06c..9bb5ae523a 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/AboutScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/AboutScreen.kt @@ -46,7 +46,7 @@ import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.LinkIcon import tachiyomi.presentation.core.components.ScrollbarLazyColumn import tachiyomi.presentation.core.components.material.Scaffold -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.icons.CustomIcons import tachiyomi.presentation.core.icons.Discord import tachiyomi.presentation.core.icons.Facebook @@ -74,7 +74,7 @@ object AboutScreen : Screen() { Scaffold( topBar = { scrollBehavior -> AppBar( - title = localize(MR.strings.pref_category_about), + title = stringResource(MR.strings.pref_category_about), navigateUp = if (handleBack != null) handleBack::invoke else null, scrollBehavior = scrollBehavior, ) @@ -89,7 +89,7 @@ object AboutScreen : Screen() { item { TextPreferenceWidget( - title = localize(MR.strings.version), + title = stringResource(MR.strings.version), subtitle = getVersionName(withBuildDate = true), onPreferenceClick = { val deviceInfo = CrashLogUtil(context).getDebugInfo() @@ -101,7 +101,7 @@ object AboutScreen : Screen() { if (BuildConfig.INCLUDE_UPDATER) { item { TextPreferenceWidget( - title = localize(MR.strings.check_for_updates), + title = stringResource(MR.strings.check_for_updates), widget = { AnimatedVisibility(visible = isCheckingUpdates) { CircularProgressIndicator( @@ -140,7 +140,7 @@ object AboutScreen : Screen() { if (!BuildConfig.DEBUG) { item { TextPreferenceWidget( - title = localize(MR.strings.whats_new), + title = stringResource(MR.strings.whats_new), onPreferenceClick = { uriHandler.openUri(RELEASE_URL) }, ) } @@ -148,21 +148,21 @@ object AboutScreen : Screen() { item { TextPreferenceWidget( - title = localize(MR.strings.help_translate), + title = stringResource(MR.strings.help_translate), onPreferenceClick = { uriHandler.openUri("https://tachiyomi.org/docs/contribute#translation") }, ) } item { TextPreferenceWidget( - title = localize(MR.strings.licenses), + title = stringResource(MR.strings.licenses), onPreferenceClick = { navigator.push(OpenSourceLicensesScreen()) }, ) } item { TextPreferenceWidget( - title = localize(MR.strings.privacy_policy), + title = stringResource(MR.strings.privacy_policy), onPreferenceClick = { uriHandler.openUri("https://tachiyomi.org/privacy/") }, ) } @@ -175,7 +175,7 @@ object AboutScreen : Screen() { horizontalArrangement = Arrangement.Center, ) { LinkIcon( - label = localize(MR.strings.website), + label = stringResource(MR.strings.website), icon = Icons.Outlined.Public, url = "https://tachiyomi.org", ) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/OpenSourceLibraryLicenseScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/OpenSourceLibraryLicenseScreen.kt index 27f7185bb2..725ed64078 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/OpenSourceLibraryLicenseScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/OpenSourceLibraryLicenseScreen.kt @@ -21,7 +21,7 @@ import eu.kanade.presentation.util.Screen import kotlinx.collections.immutable.persistentListOf import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.Scaffold -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource class OpenSourceLibraryLicenseScreen( private val name: String, @@ -44,7 +44,7 @@ class OpenSourceLibraryLicenseScreen( AppBarActions( persistentListOf( AppBar.Action( - title = localize(MR.strings.website), + title = stringResource(MR.strings.website), icon = Icons.Default.Public, onClick = { uriHandler.openUri(website) }, ), diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/OpenSourceLicensesScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/OpenSourceLicensesScreen.kt index 12f4b62905..7d072e4019 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/OpenSourceLicensesScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/OpenSourceLicensesScreen.kt @@ -13,7 +13,7 @@ import eu.kanade.presentation.components.AppBar 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 class OpenSourceLicensesScreen : Screen() { @@ -23,7 +23,7 @@ class OpenSourceLicensesScreen : Screen() { Scaffold( topBar = { scrollBehavior -> AppBar( - title = localize(MR.strings.licenses), + title = stringResource(MR.strings.licenses), navigateUp = navigator::pop, scrollBehavior = scrollBehavior, ) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/advanced/ClearDatabaseScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/advanced/ClearDatabaseScreen.kt index fc681d1900..cec3caafcc 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/advanced/ClearDatabaseScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/advanced/ClearDatabaseScreen.kt @@ -51,7 +51,7 @@ import tachiyomi.domain.source.model.Source import tachiyomi.domain.source.model.SourceWithCount 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.LoadingScreen import tachiyomi.presentation.core.util.selectedBackground @@ -85,16 +85,16 @@ class ClearDatabaseScreen : Screen() { } }, ) { - Text(text = localize(MR.strings.action_ok)) + Text(text = stringResource(MR.strings.action_ok)) } }, dismissButton = { TextButton(onClick = model::hideConfirmation) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } }, text = { - Text(text = localize(MR.strings.clear_database_confirmation)) + Text(text = stringResource(MR.strings.clear_database_confirmation)) }, ) } @@ -102,19 +102,19 @@ class ClearDatabaseScreen : Screen() { Scaffold( topBar = { scrollBehavior -> AppBar( - title = localize(MR.strings.pref_clear_database), + title = stringResource(MR.strings.pref_clear_database), navigateUp = navigator::pop, actions = { if (s.items.isNotEmpty()) { AppBarActions( actions = persistentListOf( AppBar.Action( - title = localize(MR.strings.action_select_all), + title = stringResource(MR.strings.action_select_all), icon = Icons.Outlined.SelectAll, onClick = model::selectAll, ), AppBar.Action( - title = localize(MR.strings.action_select_all), + title = stringResource(MR.strings.action_select_all), icon = Icons.Outlined.FlipToBack, onClick = model::invertSelection, ), @@ -128,7 +128,7 @@ class ClearDatabaseScreen : Screen() { ) { contentPadding -> if (s.items.isEmpty()) { EmptyScreen( - message = localize(MR.strings.database_clean), + message = stringResource(MR.strings.database_clean), modifier = Modifier.padding(contentPadding), ) } else { @@ -160,7 +160,7 @@ class ClearDatabaseScreen : Screen() { enabled = s.selection.isNotEmpty(), ) { Text( - text = localize(MR.strings.action_delete), + text = stringResource(MR.strings.action_delete), color = MaterialTheme.colorScheme.onPrimary, ) } @@ -196,7 +196,7 @@ class ClearDatabaseScreen : Screen() { text = source.visualName, style = MaterialTheme.typography.bodyMedium, ) - Text(text = localize(MR.strings.clear_database_source_item_count, count)) + Text(text = stringResource(MR.strings.clear_database_source_item_count, count)) } Checkbox( checked = isSelected, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/data/CreateBackupScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/data/CreateBackupScreen.kt index 9117f04df1..96c6ead6a0 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/data/CreateBackupScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/data/CreateBackupScreen.kt @@ -43,7 +43,7 @@ import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.LabeledCheckbox 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 class CreateBackupScreen : Screen() { @@ -71,7 +71,7 @@ class CreateBackupScreen : Screen() { Scaffold( topBar = { AppBar( - title = localize(MR.strings.pref_create_backup), + title = stringResource(MR.strings.pref_create_backup), navigateUp = navigator::pop, scrollBehavior = it, ) @@ -89,7 +89,7 @@ class CreateBackupScreen : Screen() { ) { item { LabeledCheckbox( - label = localize(MR.strings.manga), + label = stringResource(MR.strings.manga), checked = true, onCheckedChange = {}, enabled = false, @@ -98,7 +98,7 @@ class CreateBackupScreen : Screen() { BackupChoices.forEach { (k, v) -> item { LabeledCheckbox( - label = localize(v), + label = stringResource(v), checked = state.flags.contains(k), onCheckedChange = { model.toggleFlag(k) @@ -130,7 +130,7 @@ class CreateBackupScreen : Screen() { }, ) { Text( - text = localize(MR.strings.action_create), + text = stringResource(MR.strings.action_create), color = MaterialTheme.colorScheme.onPrimary, ) } diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/BackupSchemaScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/BackupSchemaScreen.kt index 41cfbc9c64..d5652b16ac 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/BackupSchemaScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/BackupSchemaScreen.kt @@ -23,7 +23,7 @@ import kotlinx.collections.immutable.persistentListOf import kotlinx.serialization.protobuf.schema.ProtoBufSchemaGenerator import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.Scaffold -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource class BackupSchemaScreen : Screen() { @@ -47,7 +47,7 @@ class BackupSchemaScreen : Screen() { AppBarActions( persistentListOf( AppBar.Action( - title = localize(MR.strings.action_copy_to_clipboard), + title = stringResource(MR.strings.action_copy_to_clipboard), icon = Icons.Default.ContentCopy, onClick = { context.copyToClipboard(title, schema) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/WorkerInfoScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/WorkerInfoScreen.kt index 08925e01c5..2c891e2717 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/WorkerInfoScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/WorkerInfoScreen.kt @@ -37,7 +37,7 @@ import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn 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.plus class WorkerInfoScreen : Screen() { @@ -65,7 +65,7 @@ class WorkerInfoScreen : Screen() { AppBarActions( persistentListOf( AppBar.Action( - title = localize(MR.strings.action_copy_to_clipboard), + title = stringResource(MR.strings.action_copy_to_clipboard), icon = Icons.Default.ContentCopy, onClick = { context.copyToClipboard(title, enqueued + finished + running) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/widget/AppThemePreferenceWidget.kt b/app/src/main/java/eu/kanade/presentation/more/settings/widget/AppThemePreferenceWidget.kt index b69550d55a..5b75997222 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/widget/AppThemePreferenceWidget.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/widget/AppThemePreferenceWidget.kt @@ -46,7 +46,7 @@ import eu.kanade.tachiyomi.util.system.DeviceUtil import eu.kanade.tachiyomi.util.system.isDynamicColorAvailable import tachiyomi.i18n.MR 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 @Composable @@ -104,7 +104,7 @@ private fun AppThemesList( Spacer(modifier = Modifier.height(8.dp)) Text( - text = localize(appTheme.titleRes!!), + text = stringResource(appTheme.titleRes!!), modifier = Modifier .fillMaxWidth() .secondaryItemAlpha(), @@ -167,7 +167,7 @@ fun AppThemePreviewItem( if (selected) { Icon( imageVector = Icons.Filled.CheckCircle, - contentDescription = localize(MR.strings.selected), + contentDescription = stringResource(MR.strings.selected), tint = MaterialTheme.colorScheme.primary, ) } diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/widget/EditTextPreferenceWidget.kt b/app/src/main/java/eu/kanade/presentation/more/settings/widget/EditTextPreferenceWidget.kt index 95141bdb89..00d8f16d43 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/widget/EditTextPreferenceWidget.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/widget/EditTextPreferenceWidget.kt @@ -23,7 +23,7 @@ import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.window.DialogProperties import kotlinx.coroutines.launch import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun EditTextPreferenceWidget( @@ -83,12 +83,12 @@ fun EditTextPreferenceWidget( } }, ) { - Text(text = localize(MR.strings.action_ok)) + Text(text = stringResource(MR.strings.action_ok)) } }, dismissButton = { TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } }, ) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/widget/InfoWidget.kt b/app/src/main/java/eu/kanade/presentation/more/settings/widget/InfoWidget.kt index f77b1db5e4..5d9d8db853 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/widget/InfoWidget.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/widget/InfoWidget.kt @@ -15,7 +15,7 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark import eu.kanade.presentation.theme.TachiyomiTheme import tachiyomi.i18n.MR 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 @Composable @@ -45,7 +45,7 @@ internal fun InfoWidget(text: String) { private fun InfoWidgetPreview() { TachiyomiTheme { Surface { - InfoWidget(text = localize(MR.strings.download_ahead_info)) + InfoWidget(text = stringResource(MR.strings.download_ahead_info)) } } } diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/widget/ListPreferenceWidget.kt b/app/src/main/java/eu/kanade/presentation/more/settings/widget/ListPreferenceWidget.kt index 44e13aeab6..c8e7574913 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/widget/ListPreferenceWidget.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/widget/ListPreferenceWidget.kt @@ -25,7 +25,7 @@ import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.unit.dp import tachiyomi.i18n.MR 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.isScrolledToStart @@ -75,7 +75,7 @@ fun ListPreferenceWidget( }, confirmButton = { TextButton(onClick = { isDialogShown = false }) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } }, ) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/widget/MultiSelectListPreferenceWidget.kt b/app/src/main/java/eu/kanade/presentation/more/settings/widget/MultiSelectListPreferenceWidget.kt index be4fbe9a04..c9ac351842 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/widget/MultiSelectListPreferenceWidget.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/widget/MultiSelectListPreferenceWidget.kt @@ -14,7 +14,7 @@ import androidx.compose.ui.window.DialogProperties import eu.kanade.presentation.more.settings.Preference import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.LabeledCheckbox -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun MultiSelectListPreferenceWidget( @@ -70,12 +70,12 @@ fun MultiSelectListPreferenceWidget( isDialogShown = false }, ) { - Text(text = localize(MR.strings.action_ok)) + Text(text = stringResource(MR.strings.action_ok)) } }, dismissButton = { TextButton(onClick = { isDialogShown = false }) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } }, ) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/widget/TrackingPreferenceWidget.kt b/app/src/main/java/eu/kanade/presentation/more/settings/widget/TrackingPreferenceWidget.kt index 02e9de53f4..81362b66c5 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/widget/TrackingPreferenceWidget.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/widget/TrackingPreferenceWidget.kt @@ -20,7 +20,7 @@ import eu.kanade.presentation.more.settings.LocalPreferenceHighlighted import eu.kanade.presentation.track.components.TrackLogoIcon import eu.kanade.tachiyomi.data.track.Tracker import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun TrackingPreferenceWidget( @@ -55,7 +55,7 @@ fun TrackingPreferenceWidget( .padding(4.dp) .size(32.dp), tint = Color(0xFF4CAF50), - contentDescription = localize(MR.strings.login_success), + contentDescription = stringResource(MR.strings.login_success), ) } } diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/widget/TriStateListDialog.kt b/app/src/main/java/eu/kanade/presentation/more/settings/widget/TriStateListDialog.kt index 0014f5dc54..f6e195e4df 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/widget/TriStateListDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/widget/TriStateListDialog.kt @@ -29,7 +29,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.unit.dp 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.isScrolledToStart @@ -102,7 +102,7 @@ fun TriStateListDialog( } else { MaterialTheme.colorScheme.primary }, - contentDescription = localize( + contentDescription = stringResource( when (state) { State.UNCHECKED -> MR.strings.not_selected State.CHECKED -> MR.strings.selected @@ -130,7 +130,7 @@ fun TriStateListDialog( }, dismissButton = { TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } }, confirmButton = { @@ -145,7 +145,7 @@ fun TriStateListDialog( onValueChanged(included, excluded) }, ) { - Text(text = localize(MR.strings.action_ok)) + Text(text = stringResource(MR.strings.action_ok)) } }, ) diff --git a/app/src/main/java/eu/kanade/presentation/more/stats/StatsScreenContent.kt b/app/src/main/java/eu/kanade/presentation/more/stats/StatsScreenContent.kt index 71bbb73b96..f35336d501 100644 --- a/app/src/main/java/eu/kanade/presentation/more/stats/StatsScreenContent.kt +++ b/app/src/main/java/eu/kanade/presentation/more/stats/StatsScreenContent.kt @@ -20,7 +20,7 @@ import eu.kanade.presentation.more.stats.data.StatsData import eu.kanade.presentation.util.toDurationString import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.padding -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import java.util.Locale import kotlin.time.DurationUnit import kotlin.time.toDuration @@ -55,7 +55,7 @@ fun StatsScreenContent( private fun OverviewSection( data: StatsData.Overview, ) { - val none = localize(MR.strings.none) + val none = stringResource(MR.strings.none) val context = LocalContext.current val readDurationString = remember(data.totalReadDuration) { data.totalReadDuration @@ -66,17 +66,17 @@ private fun OverviewSection( Row { StatsOverviewItem( title = data.libraryMangaCount.toString(), - subtitle = localize(MR.strings.in_library), + subtitle = stringResource(MR.strings.in_library), icon = Icons.Outlined.CollectionsBookmark, ) StatsOverviewItem( title = data.completedMangaCount.toString(), - subtitle = localize(MR.strings.label_completed_titles), + subtitle = stringResource(MR.strings.label_completed_titles), icon = Icons.Outlined.LocalLibrary, ) StatsOverviewItem( title = readDurationString, - subtitle = localize(MR.strings.label_read_duration), + subtitle = stringResource(MR.strings.label_read_duration), icon = Icons.Outlined.Schedule, ) } @@ -91,15 +91,15 @@ private fun TitlesStats( Row { StatsItem( data.globalUpdateItemCount.toString(), - localize(MR.strings.label_titles_in_global_update), + stringResource(MR.strings.label_titles_in_global_update), ) StatsItem( data.startedMangaCount.toString(), - localize(MR.strings.label_started), + stringResource(MR.strings.label_started), ) StatsItem( data.localMangaCount.toString(), - localize(MR.strings.label_local), + stringResource(MR.strings.label_local), ) } } @@ -113,15 +113,15 @@ private fun ChapterStats( Row { StatsItem( data.totalChapterCount.toString(), - localize(MR.strings.label_total_chapters), + stringResource(MR.strings.label_total_chapters), ) StatsItem( data.readChapterCount.toString(), - localize(MR.strings.label_read_chapters), + stringResource(MR.strings.label_read_chapters), ) StatsItem( data.downloadCount.toString(), - localize(MR.strings.label_downloaded), + stringResource(MR.strings.label_downloaded), ) } } @@ -131,7 +131,7 @@ private fun ChapterStats( private fun TrackerStats( data: StatsData.Trackers, ) { - val notApplicable = localize(MR.strings.not_applicable) + val notApplicable = stringResource(MR.strings.not_applicable) val meanScoreStr = remember(data.trackedTitleCount, data.meanScore) { if (data.trackedTitleCount > 0 && !data.meanScore.isNaN()) { // All other numbers are localized in English @@ -144,15 +144,15 @@ private fun TrackerStats( Row { StatsItem( data.trackedTitleCount.toString(), - localize(MR.strings.label_tracked_titles), + stringResource(MR.strings.label_tracked_titles), ) StatsItem( meanScoreStr, - localize(MR.strings.label_mean_score), + stringResource(MR.strings.label_mean_score), ) StatsItem( data.trackerCount.toString(), - localize(MR.strings.label_used), + stringResource(MR.strings.label_used), ) } } diff --git a/app/src/main/java/eu/kanade/presentation/more/stats/components/StatsSection.kt b/app/src/main/java/eu/kanade/presentation/more/stats/components/StatsSection.kt index cb4596bfdb..d5795fab24 100644 --- a/app/src/main/java/eu/kanade/presentation/more/stats/components/StatsSection.kt +++ b/app/src/main/java/eu/kanade/presentation/more/stats/components/StatsSection.kt @@ -10,7 +10,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import dev.icerock.moko.resources.StringResource import tachiyomi.presentation.core.components.material.padding -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun StatsSection( @@ -19,7 +19,7 @@ fun StatsSection( ) { Text( modifier = Modifier.padding(horizontal = MaterialTheme.padding.extraLarge), - text = localize(titleRes), + text = stringResource(titleRes), style = MaterialTheme.typography.titleSmall, ) ElevatedCard( diff --git a/app/src/main/java/eu/kanade/presentation/reader/ChapterTransition.kt b/app/src/main/java/eu/kanade/presentation/reader/ChapterTransition.kt index 4f94b3e3d6..4221923832 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/ChapterTransition.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/ChapterTransition.kt @@ -41,8 +41,8 @@ import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter import tachiyomi.domain.chapter.service.calculateChapterGap import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize -import tachiyomi.presentation.core.i18n.localizePlural +import tachiyomi.presentation.core.i18n.pluralStringResource +import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.util.secondaryItemAlpha @Composable @@ -58,25 +58,25 @@ fun ChapterTransition( when (transition) { is ChapterTransition.Prev -> { TransitionText( - topLabel = localize(MR.strings.transition_previous), + topLabel = stringResource(MR.strings.transition_previous), topChapter = goingToChapter, topChapterDownloaded = goingToChapterDownloaded, - bottomLabel = localize(MR.strings.transition_current), + bottomLabel = stringResource(MR.strings.transition_current), bottomChapter = currChapter, bottomChapterDownloaded = currChapterDownloaded, - fallbackLabel = localize(MR.strings.transition_no_previous), + fallbackLabel = stringResource(MR.strings.transition_no_previous), chapterGap = calculateChapterGap(currChapter.toDomainChapter(), goingToChapter?.toDomainChapter()), ) } is ChapterTransition.Next -> { TransitionText( - topLabel = localize(MR.strings.transition_finished), + topLabel = stringResource(MR.strings.transition_finished), topChapter = currChapter, topChapterDownloaded = currChapterDownloaded, - bottomLabel = localize(MR.strings.transition_next), + bottomLabel = stringResource(MR.strings.transition_next), bottomChapter = goingToChapter, bottomChapterDownloaded = goingToChapterDownloaded, - fallbackLabel = localize(MR.strings.transition_no_next), + fallbackLabel = stringResource(MR.strings.transition_no_next), chapterGap = calculateChapterGap(goingToChapter?.toDomainChapter(), currChapter.toDomainChapter()), ) } @@ -191,7 +191,7 @@ private fun ChapterGapWarning( ) Text( - text = localizePlural(MR.plurals.missing_chapters_warning, count = gapCount, gapCount), + text = pluralStringResource(MR.plurals.missing_chapters_warning, count = gapCount, gapCount), style = MaterialTheme.typography.bodyMedium, ) } @@ -245,7 +245,7 @@ private fun ChapterText( ) { Icon( imageVector = Icons.Filled.CheckCircle, - contentDescription = localize(MR.strings.label_downloaded), + contentDescription = stringResource(MR.strings.label_downloaded), ) }, ), diff --git a/app/src/main/java/eu/kanade/presentation/reader/OrientationSelectDialog.kt b/app/src/main/java/eu/kanade/presentation/reader/OrientationSelectDialog.kt index 27f4173c9f..ea6f3d58ff 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/OrientationSelectDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/OrientationSelectDialog.kt @@ -24,7 +24,7 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.SettingsIconGrid import tachiyomi.presentation.core.components.material.IconToggleButton -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource private val ReaderOrientationsWithoutDefault = ReaderOrientation.entries - ReaderOrientation.DEFAULT @@ -73,7 +73,7 @@ private fun DialogContent( }, modifier = Modifier.fillMaxWidth(), imageVector = ImageVector.vectorResource(mode.iconRes), - title = localize(mode.stringRes), + title = stringResource(mode.stringRes), ) } } diff --git a/app/src/main/java/eu/kanade/presentation/reader/ReaderPageActionsDialog.kt b/app/src/main/java/eu/kanade/presentation/reader/ReaderPageActionsDialog.kt index 5120a7de2f..70cc58f207 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/ReaderPageActionsDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/ReaderPageActionsDialog.kt @@ -22,7 +22,7 @@ import eu.kanade.presentation.components.AdaptiveSheet import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.ActionButton import tachiyomi.presentation.core.components.material.padding -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun ReaderPageActionsDialog( @@ -42,13 +42,13 @@ fun ReaderPageActionsDialog( ) { ActionButton( modifier = Modifier.weight(1f), - title = localize(MR.strings.set_as_cover), + title = stringResource(MR.strings.set_as_cover), icon = Icons.Outlined.Photo, onClick = { showSetCoverDialog = true }, ) ActionButton( modifier = Modifier.weight(1f), - title = localize(MR.strings.action_share), + title = stringResource(MR.strings.action_share), icon = Icons.Outlined.Share, onClick = { onShare() @@ -57,7 +57,7 @@ fun ReaderPageActionsDialog( ) ActionButton( modifier = Modifier.weight(1f), - title = localize(MR.strings.action_save), + title = stringResource(MR.strings.action_save), icon = Icons.Outlined.Save, onClick = { onSave() @@ -85,16 +85,16 @@ private fun SetCoverDialog( ) { AlertDialog( text = { - Text(localize(MR.strings.confirm_set_image_as_cover)) + Text(stringResource(MR.strings.confirm_set_image_as_cover)) }, confirmButton = { TextButton(onClick = onConfirm) { - Text(localize(MR.strings.action_ok)) + Text(stringResource(MR.strings.action_ok)) } }, dismissButton = { TextButton(onClick = onDismiss) { - Text(localize(MR.strings.action_cancel)) + Text(stringResource(MR.strings.action_cancel)) } }, onDismissRequest = onDismiss, diff --git a/app/src/main/java/eu/kanade/presentation/reader/ReadingModeSelectDialog.kt b/app/src/main/java/eu/kanade/presentation/reader/ReadingModeSelectDialog.kt index 3590f4601a..25c0893c69 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/ReadingModeSelectDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/ReadingModeSelectDialog.kt @@ -24,7 +24,7 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.SettingsIconGrid import tachiyomi.presentation.core.components.material.IconToggleButton -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource private val ReadingModesWithoutDefault = ReadingMode.entries - ReadingMode.DEFAULT @@ -69,7 +69,7 @@ private fun DialogContent( }, modifier = Modifier.fillMaxWidth(), imageVector = ImageVector.vectorResource(mode.iconRes), - title = localize(mode.stringRes), + title = stringResource(mode.stringRes), ) } } diff --git a/app/src/main/java/eu/kanade/presentation/reader/appbars/BottomReaderBar.kt b/app/src/main/java/eu/kanade/presentation/reader/appbars/BottomReaderBar.kt index 7c9faa988f..b1f7189edf 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/appbars/BottomReaderBar.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/appbars/BottomReaderBar.kt @@ -19,7 +19,7 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.reader.setting.ReaderOrientation import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun BottomReaderBar( @@ -43,28 +43,28 @@ fun BottomReaderBar( IconButton(onClick = onClickReadingMode) { Icon( painter = painterResource(readingMode.iconRes), - contentDescription = localize(MR.strings.viewer), + contentDescription = stringResource(MR.strings.viewer), ) } IconButton(onClick = onClickOrientation) { Icon( painter = painterResource(orientation.iconRes), - contentDescription = localize(MR.strings.rotation_type), + contentDescription = stringResource(MR.strings.rotation_type), ) } IconButton(onClick = onClickCropBorder) { Icon( painter = painterResource(if (cropEnabled) R.drawable.ic_crop_24dp else R.drawable.ic_crop_off_24dp), - contentDescription = localize(MR.strings.pref_crop_borders), + contentDescription = stringResource(MR.strings.pref_crop_borders), ) } IconButton(onClick = onClickSettings) { Icon( imageVector = Icons.Outlined.Settings, - contentDescription = localize(MR.strings.action_settings), + contentDescription = stringResource(MR.strings.action_settings), ) } } diff --git a/app/src/main/java/eu/kanade/presentation/reader/appbars/ReaderAppBars.kt b/app/src/main/java/eu/kanade/presentation/reader/appbars/ReaderAppBars.kt index dfc9969b85..06ba7e7e2a 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/appbars/ReaderAppBars.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/appbars/ReaderAppBars.kt @@ -29,7 +29,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.Viewer import eu.kanade.tachiyomi.ui.reader.viewer.pager.R2LPagerViewer import kotlinx.collections.immutable.persistentListOf import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource private val animationSpec = tween(200) @@ -103,7 +103,7 @@ fun ReaderAppBars( .apply { add( AppBar.Action( - title = localize( + title = stringResource( if (bookmarked) { MR.strings.action_remove_bookmark } else { @@ -121,7 +121,7 @@ fun ReaderAppBars( onOpenInWebView?.let { add( AppBar.OverflowAction( - title = localize(MR.strings.action_open_in_web_view), + title = stringResource(MR.strings.action_open_in_web_view), onClick = it, ), ) @@ -129,7 +129,7 @@ fun ReaderAppBars( onShare?.let { add( AppBar.OverflowAction( - title = localize(MR.strings.action_share), + title = stringResource(MR.strings.action_share), onClick = it, ), ) diff --git a/app/src/main/java/eu/kanade/presentation/reader/components/ChapterNavigator.kt b/app/src/main/java/eu/kanade/presentation/reader/components/ChapterNavigator.kt index d18915c5aa..070b81e915 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/components/ChapterNavigator.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/components/ChapterNavigator.kt @@ -34,7 +34,7 @@ import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.dp import eu.kanade.presentation.util.isTabletUi import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import kotlin.math.roundToInt @Composable @@ -77,7 +77,7 @@ fun ChapterNavigator( ) { Icon( imageVector = Icons.Outlined.SkipPrevious, - contentDescription = localize( + contentDescription = stringResource( if (isRtl) MR.strings.action_next_chapter else MR.strings.action_previous_chapter, ), ) @@ -129,7 +129,7 @@ fun ChapterNavigator( ) { Icon( imageVector = Icons.Outlined.SkipNext, - contentDescription = localize( + contentDescription = stringResource( if (isRtl) MR.strings.action_previous_chapter else MR.strings.action_next_chapter, ), ) diff --git a/app/src/main/java/eu/kanade/presentation/reader/components/ModeSelectionDialog.kt b/app/src/main/java/eu/kanade/presentation/reader/components/ModeSelectionDialog.kt index d519e31773..14635e50f4 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/components/ModeSelectionDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/components/ModeSelectionDialog.kt @@ -21,7 +21,7 @@ import androidx.compose.ui.unit.dp import eu.kanade.presentation.theme.TachiyomiTheme import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.SettingsItemsPaddings -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun ModeSelectionDialog( @@ -40,7 +40,7 @@ fun ModeSelectionDialog( ) { onUseDefault?.let { OutlinedButton(onClick = it) { - Text(text = localize(MR.strings.action_revert_to_default)) + Text(text = stringResource(MR.strings.action_revert_to_default)) } } @@ -57,7 +57,7 @@ fun ModeSelectionDialog( imageVector = Icons.Outlined.Check, contentDescription = null, ) - Text(text = localize(MR.strings.action_apply)) + Text(text = stringResource(MR.strings.action_apply)) } } } diff --git a/app/src/main/java/eu/kanade/presentation/reader/settings/ColorFilterPage.kt b/app/src/main/java/eu/kanade/presentation/reader/settings/ColorFilterPage.kt index 3b8d39b788..1e7324956b 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/settings/ColorFilterPage.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/settings/ColorFilterPage.kt @@ -16,7 +16,7 @@ import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.CheckboxItem import tachiyomi.presentation.core.components.SettingsChipRow import tachiyomi.presentation.core.components.SliderItem -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.util.collectAsState @Composable @@ -38,11 +38,11 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel) ), ) } - }.map { localize(it) } + }.map { stringResource(it) } val customBrightness by screenModel.preferences.customBrightness().collectAsState() CheckboxItem( - label = localize(MR.strings.pref_custom_brightness), + label = stringResource(MR.strings.pref_custom_brightness), pref = screenModel.preferences.customBrightness(), ) @@ -55,7 +55,7 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel) if (customBrightness) { val customBrightnessValue by screenModel.preferences.customBrightnessValue().collectAsState() SliderItem( - label = localize(MR.strings.pref_custom_brightness), + label = stringResource(MR.strings.pref_custom_brightness), min = -75, max = 100, value = customBrightnessValue, @@ -66,13 +66,13 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel) val colorFilter by screenModel.preferences.colorFilter().collectAsState() CheckboxItem( - label = localize(MR.strings.pref_custom_color_filter), + label = stringResource(MR.strings.pref_custom_color_filter), pref = screenModel.preferences.colorFilter(), ) if (colorFilter) { val colorFilterValue by screenModel.preferences.colorFilterValue().collectAsState() SliderItem( - label = localize(MR.strings.color_filter_r_value), + label = stringResource(MR.strings.color_filter_r_value), max = 255, value = colorFilterValue.red, valueText = colorFilterValue.red.toString(), @@ -83,7 +83,7 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel) }, ) SliderItem( - label = localize(MR.strings.color_filter_g_value), + label = stringResource(MR.strings.color_filter_g_value), max = 255, value = colorFilterValue.green, valueText = colorFilterValue.green.toString(), @@ -94,7 +94,7 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel) }, ) SliderItem( - label = localize(MR.strings.color_filter_b_value), + label = stringResource(MR.strings.color_filter_b_value), max = 255, value = colorFilterValue.blue, valueText = colorFilterValue.blue.toString(), @@ -105,7 +105,7 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel) }, ) SliderItem( - label = localize(MR.strings.color_filter_a_value), + label = stringResource(MR.strings.color_filter_a_value), max = 255, value = colorFilterValue.alpha, valueText = colorFilterValue.alpha.toString(), @@ -129,11 +129,11 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel) } CheckboxItem( - label = localize(MR.strings.pref_grayscale), + label = stringResource(MR.strings.pref_grayscale), pref = screenModel.preferences.grayscale(), ) CheckboxItem( - label = localize(MR.strings.pref_inverted_colors), + label = stringResource(MR.strings.pref_inverted_colors), pref = screenModel.preferences.invertedColors(), ) } diff --git a/app/src/main/java/eu/kanade/presentation/reader/settings/GeneralSettingsPage.kt b/app/src/main/java/eu/kanade/presentation/reader/settings/GeneralSettingsPage.kt index 1b236feb42..6b631d4eec 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/settings/GeneralSettingsPage.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/settings/GeneralSettingsPage.kt @@ -9,7 +9,7 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.CheckboxItem import tachiyomi.presentation.core.components.SettingsChipRow -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.util.collectAsState private val themes = listOf( @@ -27,50 +27,50 @@ internal fun ColumnScope.GeneralPage(screenModel: ReaderSettingsScreenModel) { FilterChip( selected = readerTheme == value, onClick = { screenModel.preferences.readerTheme().set(value) }, - label = { Text(localize(labelRes)) }, + label = { Text(stringResource(labelRes)) }, ) } } CheckboxItem( - label = localize(MR.strings.pref_show_page_number), + label = stringResource(MR.strings.pref_show_page_number), pref = screenModel.preferences.showPageNumber(), ) CheckboxItem( - label = localize(MR.strings.pref_fullscreen), + label = stringResource(MR.strings.pref_fullscreen), pref = screenModel.preferences.fullscreen(), ) if (screenModel.hasDisplayCutout) { CheckboxItem( - label = localize(MR.strings.pref_cutout_short), + label = stringResource(MR.strings.pref_cutout_short), pref = screenModel.preferences.cutoutShort(), ) } CheckboxItem( - label = localize(MR.strings.pref_keep_screen_on), + label = stringResource(MR.strings.pref_keep_screen_on), pref = screenModel.preferences.keepScreenOn(), ) CheckboxItem( - label = localize(MR.strings.pref_read_with_long_tap), + label = stringResource(MR.strings.pref_read_with_long_tap), pref = screenModel.preferences.readWithLongTap(), ) CheckboxItem( - label = localize(MR.strings.pref_always_show_chapter_transition), + label = stringResource(MR.strings.pref_always_show_chapter_transition), pref = screenModel.preferences.alwaysShowChapterTransition(), ) CheckboxItem( - label = localize(MR.strings.pref_page_transitions), + label = stringResource(MR.strings.pref_page_transitions), pref = screenModel.preferences.pageTransitions(), ) CheckboxItem( - label = localize(MR.strings.pref_flash_page), + label = stringResource(MR.strings.pref_flash_page), pref = screenModel.preferences.flashOnPageChange(), ) } diff --git a/app/src/main/java/eu/kanade/presentation/reader/settings/ReaderSettingsDialog.kt b/app/src/main/java/eu/kanade/presentation/reader/settings/ReaderSettingsDialog.kt index 7360a1c0a5..a15c9e5414 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/settings/ReaderSettingsDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/settings/ReaderSettingsDialog.kt @@ -17,7 +17,7 @@ import eu.kanade.presentation.components.TabbedDialogPaddings import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel import kotlinx.collections.immutable.persistentListOf import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun ReaderSettingsDialog( @@ -27,9 +27,9 @@ fun ReaderSettingsDialog( screenModel: ReaderSettingsScreenModel, ) { val tabTitles = persistentListOf( - localize(MR.strings.pref_category_reading_mode), - localize(MR.strings.pref_category_general), - localize(MR.strings.custom_filter), + stringResource(MR.strings.pref_category_reading_mode), + stringResource(MR.strings.pref_category_general), + stringResource(MR.strings.custom_filter), ) val pagerState = rememberPagerState { tabTitles.size } diff --git a/app/src/main/java/eu/kanade/presentation/reader/settings/ReadingModePage.kt b/app/src/main/java/eu/kanade/presentation/reader/settings/ReadingModePage.kt index 6e0fc893e9..89fcac78ab 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/settings/ReadingModePage.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/settings/ReadingModePage.kt @@ -19,7 +19,7 @@ import tachiyomi.presentation.core.components.CheckboxItem import tachiyomi.presentation.core.components.HeadingItem import tachiyomi.presentation.core.components.SettingsChipRow import tachiyomi.presentation.core.components.SliderItem -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.util.collectAsState import java.text.NumberFormat @@ -34,7 +34,7 @@ internal fun ColumnScope.ReadingModePage(screenModel: ReaderSettingsScreenModel) FilterChip( selected = it == readingMode, onClick = { screenModel.onChangeReadingMode(it) }, - label = { Text(localize(it.stringRes)) }, + label = { Text(stringResource(it.stringRes)) }, ) } } @@ -45,7 +45,7 @@ internal fun ColumnScope.ReadingModePage(screenModel: ReaderSettingsScreenModel) FilterChip( selected = it == orientation, onClick = { screenModel.onChangeOrientation(it) }, - label = { Text(localize(it.stringRes)) }, + label = { Text(stringResource(it.stringRes)) }, ) } } @@ -77,7 +77,7 @@ private fun ColumnScope.PagerViewerSettings(screenModel: ReaderSettingsScreenMod FilterChip( selected = imageScaleType == index + 1, onClick = { screenModel.preferences.imageScaleType().set(index + 1) }, - label = { Text(localize(it)) }, + label = { Text(stringResource(it)) }, ) } } @@ -88,48 +88,48 @@ private fun ColumnScope.PagerViewerSettings(screenModel: ReaderSettingsScreenMod FilterChip( selected = zoomStart == index + 1, onClick = { screenModel.preferences.zoomStart().set(index + 1) }, - label = { Text(localize(it)) }, + label = { Text(stringResource(it)) }, ) } } CheckboxItem( - label = localize(MR.strings.pref_crop_borders), + label = stringResource(MR.strings.pref_crop_borders), pref = screenModel.preferences.cropBorders(), ) CheckboxItem( - label = localize(MR.strings.pref_landscape_zoom), + label = stringResource(MR.strings.pref_landscape_zoom), pref = screenModel.preferences.landscapeZoom(), ) CheckboxItem( - label = localize(MR.strings.pref_navigate_pan), + label = stringResource(MR.strings.pref_navigate_pan), pref = screenModel.preferences.navigateToPan(), ) val dualPageSplitPaged by screenModel.preferences.dualPageSplitPaged().collectAsState() CheckboxItem( - label = localize(MR.strings.pref_dual_page_split), + label = stringResource(MR.strings.pref_dual_page_split), pref = screenModel.preferences.dualPageSplitPaged(), ) if (dualPageSplitPaged) { CheckboxItem( - label = localize(MR.strings.pref_dual_page_invert), + label = stringResource(MR.strings.pref_dual_page_invert), pref = screenModel.preferences.dualPageInvertPaged(), ) } val dualPageRotateToFit by screenModel.preferences.dualPageRotateToFit().collectAsState() CheckboxItem( - label = localize(MR.strings.pref_page_rotate), + label = stringResource(MR.strings.pref_page_rotate), pref = screenModel.preferences.dualPageRotateToFit(), ) if (dualPageRotateToFit) { CheckboxItem( - label = localize(MR.strings.pref_page_rotate_invert), + label = stringResource(MR.strings.pref_page_rotate_invert), pref = screenModel.preferences.dualPageRotateToFitInvert(), ) } @@ -152,7 +152,7 @@ private fun ColumnScope.WebtoonViewerSettings(screenModel: ReaderSettingsScreenM val webtoonSidePadding by screenModel.preferences.webtoonSidePadding().collectAsState() SliderItem( - label = localize(MR.strings.pref_webtoon_side_padding), + label = stringResource(MR.strings.pref_webtoon_side_padding), min = ReaderPreferences.WEBTOON_PADDING_MIN, max = ReaderPreferences.WEBTOON_PADDING_MAX, value = webtoonSidePadding, @@ -163,25 +163,25 @@ private fun ColumnScope.WebtoonViewerSettings(screenModel: ReaderSettingsScreenM ) CheckboxItem( - label = localize(MR.strings.pref_crop_borders), + label = stringResource(MR.strings.pref_crop_borders), pref = screenModel.preferences.cropBordersWebtoon(), ) val dualPageSplitWebtoon by screenModel.preferences.dualPageSplitWebtoon().collectAsState() CheckboxItem( - label = localize(MR.strings.pref_dual_page_split), + label = stringResource(MR.strings.pref_dual_page_split), pref = screenModel.preferences.dualPageSplitWebtoon(), ) if (dualPageSplitWebtoon) { CheckboxItem( - label = localize(MR.strings.pref_dual_page_invert), + label = stringResource(MR.strings.pref_dual_page_invert), pref = screenModel.preferences.dualPageInvertWebtoon(), ) } CheckboxItem( - label = localize(MR.strings.pref_double_tap_zoom), + label = stringResource(MR.strings.pref_double_tap_zoom), pref = screenModel.preferences.webtoonDoubleTapZoomEnabled(), ) } @@ -198,7 +198,7 @@ private fun ColumnScope.TapZonesItems( FilterChip( selected = selected == index, onClick = { onSelect(index) }, - label = { Text(localize(it)) }, + label = { Text(stringResource(it)) }, ) } } @@ -209,7 +209,7 @@ private fun ColumnScope.TapZonesItems( FilterChip( selected = it == invertMode, onClick = { onSelectInvertMode(it) }, - label = { Text(localize(it.titleRes)) }, + label = { Text(stringResource(it.titleRes)) }, ) } } diff --git a/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogHome.kt b/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogHome.kt index 3a05bc31ca..78b8fc953a 100644 --- a/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogHome.kt +++ b/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogHome.kt @@ -55,7 +55,7 @@ import eu.kanade.tachiyomi.data.track.Tracker import eu.kanade.tachiyomi.ui.manga.track.TrackItem import eu.kanade.tachiyomi.util.system.copyToClipboard import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import java.text.DateFormat private const val UnsetStatusTextAlpha = 0.5F @@ -194,7 +194,7 @@ private fun TrackInfoItem( Row(modifier = Modifier.height(IntrinsicSize.Min)) { TrackDetailsItem( modifier = Modifier.weight(1f), - text = status?.let { localize(it) } ?: "", + text = status?.let { stringResource(it) } ?: "", onClick = onStatusClick, ) VerticalDivider() @@ -209,7 +209,7 @@ private fun TrackInfoItem( modifier = Modifier .weight(1f) .alpha(if (score == null) UnsetStatusTextAlpha else 1f), - text = score ?: localize(MR.strings.score), + text = score ?: stringResource(MR.strings.score), onClick = onScoreClick, ) } @@ -221,14 +221,14 @@ private fun TrackInfoItem( TrackDetailsItem( modifier = Modifier.weight(1F), text = startDate, - placeholder = localize(MR.strings.track_started_reading_date), + placeholder = stringResource(MR.strings.track_started_reading_date), onClick = onStartDateClick, ) VerticalDivider() TrackDetailsItem( modifier = Modifier.weight(1F), text = endDate, - placeholder = localize(MR.strings.track_finished_reading_date), + placeholder = stringResource(MR.strings.track_finished_reading_date), onClick = onEndDateClick, ) } @@ -279,7 +279,7 @@ private fun TrackInfoItemEmpty( .padding(start = 16.dp) .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 }) { Icon( imageVector = Icons.Default.MoreVert, - contentDescription = localize(MR.strings.label_more), + contentDescription = stringResource(MR.strings.label_more), ) } DropdownMenu( @@ -302,14 +302,14 @@ private fun TrackInfoItemMenu( onDismissRequest = { expanded = false }, ) { DropdownMenuItem( - text = { Text(localize(MR.strings.action_open_in_browser)) }, + text = { Text(stringResource(MR.strings.action_open_in_browser)) }, onClick = { onOpenInBrowser() expanded = false }, ) DropdownMenuItem( - text = { Text(localize(MR.strings.action_remove)) }, + text = { Text(stringResource(MR.strings.action_remove)) }, onClick = { onRemoved() expanded = false diff --git a/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogSelector.kt b/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogSelector.kt index 38488d9f68..c7675fbe74 100644 --- a/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogSelector.kt +++ b/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogSelector.kt @@ -41,7 +41,7 @@ import tachiyomi.presentation.core.components.WheelNumberPicker import tachiyomi.presentation.core.components.WheelTextPicker 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 tachiyomi.presentation.core.util.isScrolledToEnd import tachiyomi.presentation.core.util.isScrolledToStart @@ -54,7 +54,7 @@ fun TrackStatusSelector( onDismissRequest: () -> Unit, ) { BaseSelector( - title = localize(MR.strings.status), + title = stringResource(MR.strings.status), content = { val state = rememberLazyListState() ScrollbarLazyColumn(state = state) { @@ -77,7 +77,7 @@ fun TrackStatusSelector( onClick = null, ) Text( - text = value?.let { localize(it) } ?: "", + text = value?.let { stringResource(it) } ?: "", style = MaterialTheme.typography.bodyLarge.merge(), modifier = Modifier.padding(start = 24.dp), ) @@ -102,7 +102,7 @@ fun TrackChapterSelector( onDismissRequest: () -> Unit, ) { BaseSelector( - title = localize(MR.strings.chapters), + title = stringResource(MR.strings.chapters), content = { WheelNumberPicker( items = range.toImmutableList(), @@ -125,7 +125,7 @@ fun TrackScoreSelector( onDismissRequest: () -> Unit, ) { BaseSelector( - title = localize(MR.strings.score), + title = stringResource(MR.strings.score), content = { WheelTextPicker( items = selections, @@ -172,15 +172,15 @@ fun TrackDateSelector( ) { if (onRemove != null) { TextButton(onClick = onRemove) { - Text(text = localize(MR.strings.action_remove)) + Text(text = stringResource(MR.strings.action_remove)) } Spacer(modifier = Modifier.weight(1f)) } TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } 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)) } TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } TextButton(onClick = onConfirm) { - Text(text = localize(MR.strings.action_ok)) + Text(text = stringResource(MR.strings.action_ok)) } } }, diff --git a/app/src/main/java/eu/kanade/presentation/track/TrackerSearch.kt b/app/src/main/java/eu/kanade/presentation/track/TrackerSearch.kt index f26af7c108..f2aa4fb16e 100644 --- a/app/src/main/java/eu/kanade/presentation/track/TrackerSearch.kt +++ b/app/src/main/java/eu/kanade/presentation/track/TrackerSearch.kt @@ -65,7 +65,7 @@ import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.ScrollbarLazyColumn 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.presentation.core.screens.EmptyScreen import tachiyomi.presentation.core.screens.LoadingScreen import tachiyomi.presentation.core.util.plus @@ -120,7 +120,7 @@ fun TrackerSearch( decorationBox = { if (query.text.isEmpty()) { Text( - text = localize(MR.strings.action_search_hint), + text = stringResource(MR.strings.action_search_hint), color = MaterialTheme.colorScheme.onSurfaceVariant, style = MaterialTheme.typography.bodyLarge, ) @@ -163,7 +163,7 @@ fun TrackerSearch( .fillMaxWidth(), elevation = ButtonDefaults.elevatedButtonElevation(), ) { - Text(text = localize(MR.strings.action_track)) + Text(text = stringResource(MR.strings.action_track)) } } }, @@ -204,7 +204,7 @@ fun TrackerSearch( EmptyScreen( modifier = Modifier.padding(innerPadding), message = queryResult.exceptionOrNull()?.message - ?: localize(MR.strings.unknown_error), + ?: stringResource(MR.strings.unknown_error), ) } } @@ -263,19 +263,19 @@ private fun SearchResultItem( ) if (type.isNotBlank()) { SearchResultItemDetails( - title = localize(MR.strings.track_type), + title = stringResource(MR.strings.track_type), text = type, ) } if (startDate.isNotBlank()) { SearchResultItemDetails( - title = localize(MR.strings.label_started), + title = stringResource(MR.strings.label_started), text = startDate, ) } if (status.isNotBlank()) { SearchResultItemDetails( - title = localize(MR.strings.track_status), + title = stringResource(MR.strings.track_status), text = status, ) } diff --git a/app/src/main/java/eu/kanade/presentation/updates/UpdatesDialog.kt b/app/src/main/java/eu/kanade/presentation/updates/UpdatesDialog.kt index 4c2c24acc9..cd597aced2 100644 --- a/app/src/main/java/eu/kanade/presentation/updates/UpdatesDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/updates/UpdatesDialog.kt @@ -5,7 +5,7 @@ import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun UpdatesDeleteConfirmationDialog( @@ -14,7 +14,7 @@ fun UpdatesDeleteConfirmationDialog( ) { AlertDialog( text = { - Text(text = localize(MR.strings.confirm_delete_chapters)) + Text(text = stringResource(MR.strings.confirm_delete_chapters)) }, onDismissRequest = onDismissRequest, confirmButton = { @@ -22,12 +22,12 @@ fun UpdatesDeleteConfirmationDialog( onConfirm() onDismissRequest() }) { - Text(text = localize(MR.strings.action_ok)) + Text(text = stringResource(MR.strings.action_ok)) } }, dismissButton = { TextButton(onClick = onDismissRequest) { - Text(text = localize(MR.strings.action_cancel)) + Text(text = stringResource(MR.strings.action_cancel)) } }, ) diff --git a/app/src/main/java/eu/kanade/presentation/updates/UpdatesScreen.kt b/app/src/main/java/eu/kanade/presentation/updates/UpdatesScreen.kt index 0f042e0dae..15f1f57cbc 100644 --- a/app/src/main/java/eu/kanade/presentation/updates/UpdatesScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/updates/UpdatesScreen.kt @@ -34,7 +34,7 @@ import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.FastScrollLazyColumn import tachiyomi.presentation.core.components.material.PullRefresh 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.LoadingScreen import kotlin.time.Duration.Companion.seconds @@ -140,12 +140,12 @@ private fun UpdatesAppBar( ) { AppBar( modifier = modifier, - title = localize(MR.strings.label_recent_updates), + title = stringResource(MR.strings.label_recent_updates), actions = { AppBarActions( persistentListOf( AppBar.Action( - title = localize(MR.strings.action_update_library), + title = stringResource(MR.strings.action_update_library), icon = Icons.Outlined.Refresh, onClick = onUpdateLibrary, ), @@ -158,12 +158,12 @@ private fun UpdatesAppBar( AppBarActions( persistentListOf( AppBar.Action( - title = localize(MR.strings.action_select_all), + title = stringResource(MR.strings.action_select_all), icon = Icons.Outlined.SelectAll, onClick = onSelectAll, ), AppBar.Action( - title = localize(MR.strings.action_select_inverse), + title = stringResource(MR.strings.action_select_inverse), icon = Icons.Outlined.FlipToBack, onClick = onInvertSelection, ), diff --git a/app/src/main/java/eu/kanade/presentation/updates/UpdatesUiItem.kt b/app/src/main/java/eu/kanade/presentation/updates/UpdatesUiItem.kt index 5766a9bec9..ad2e0dbc35 100644 --- a/app/src/main/java/eu/kanade/presentation/updates/UpdatesUiItem.kt +++ b/app/src/main/java/eu/kanade/presentation/updates/UpdatesUiItem.kt @@ -44,7 +44,7 @@ import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.ListGroupHeader import tachiyomi.presentation.core.components.material.ReadItemAlpha 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 internal fun LazyListScope.updatesLastUpdatedItem( @@ -56,7 +56,7 @@ internal fun LazyListScope.updatesLastUpdatedItem( .padding(horizontal = MaterialTheme.padding.medium, vertical = MaterialTheme.padding.small), ) { Text( - text = localize(MR.strings.updates_last_update_info, relativeTimeSpanString(lastUpdated)), + text = stringResource(MR.strings.updates_last_update_info, relativeTimeSpanString(lastUpdated)), fontStyle = FontStyle.Italic, ) } @@ -100,7 +100,7 @@ internal fun LazyListScope.updatesUiItems( readProgress = updatesItem.update.lastPageRead .takeIf { !updatesItem.update.read && it > 0L } ?.let { - localize( + stringResource( MR.strings.chapter_progress, it + 1, ) @@ -183,7 +183,7 @@ private fun UpdatesUiItem( if (!update.read) { Icon( imageVector = Icons.Filled.Circle, - contentDescription = localize(MR.strings.unread), + contentDescription = stringResource(MR.strings.unread), modifier = Modifier .height(8.dp) .padding(end = 4.dp), @@ -193,7 +193,7 @@ private fun UpdatesUiItem( if (update.bookmark) { Icon( imageVector = Icons.Filled.Bookmark, - contentDescription = localize(MR.strings.action_filter_bookmarked), + contentDescription = stringResource(MR.strings.action_filter_bookmarked), modifier = Modifier .sizeIn(maxHeight = with(LocalDensity.current) { textHeight.toDp() - 2.dp }), tint = MaterialTheme.colorScheme.primary, diff --git a/app/src/main/java/eu/kanade/presentation/util/ExceptionFormatter.kt b/app/src/main/java/eu/kanade/presentation/util/ExceptionFormatter.kt index 4b91347962..a76a225b9f 100644 --- a/app/src/main/java/eu/kanade/presentation/util/ExceptionFormatter.kt +++ b/app/src/main/java/eu/kanade/presentation/util/ExceptionFormatter.kt @@ -4,7 +4,7 @@ import android.content.Context import eu.kanade.tachiyomi.network.HttpException import eu.kanade.tachiyomi.source.online.LicensedMangaChaptersException import eu.kanade.tachiyomi.util.system.isOnline -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.data.source.NoResultsException import tachiyomi.domain.source.model.SourceNotInstalledException import tachiyomi.i18n.MR @@ -14,18 +14,18 @@ context(Context) val Throwable.formattedMessage: String get() { when (this) { - is HttpException -> return localize(MR.strings.exception_http, code) + is HttpException -> return stringResource(MR.strings.exception_http, code) is UnknownHostException -> { return if (!isOnline()) { - localize(MR.strings.exception_offline) + stringResource(MR.strings.exception_offline) } 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 SourceNotInstalledException -> return localize(MR.strings.loader_not_implemented_error) - is LicensedMangaChaptersException -> return localize(MR.strings.licensed_manga_chapters_error) + is NoResultsException -> return stringResource(MR.strings.no_results_found) + is SourceNotInstalledException -> return stringResource(MR.strings.loader_not_implemented_error) + is LicensedMangaChaptersException -> return stringResource(MR.strings.licensed_manga_chapters_error) } return when (val className = this::class.simpleName) { "Exception", "IOException" -> message ?: className diff --git a/app/src/main/java/eu/kanade/presentation/util/TimeUtils.kt b/app/src/main/java/eu/kanade/presentation/util/TimeUtils.kt index 8eaff72a9d..b8dc096933 100644 --- a/app/src/main/java/eu/kanade/presentation/util/TimeUtils.kt +++ b/app/src/main/java/eu/kanade/presentation/util/TimeUtils.kt @@ -4,9 +4,9 @@ import android.content.Context import android.text.format.DateUtils import androidx.compose.runtime.Composable import androidx.compose.runtime.ReadOnlyComposable -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 import java.util.Date import kotlin.time.Duration import kotlin.time.Duration.Companion.minutes @@ -14,10 +14,14 @@ import kotlin.time.Duration.Companion.minutes fun Duration.toDurationString(context: Context, fallback: String): String { return toComponents { days, hours, minutes, seconds, _ -> buildList(4) { - if (days != 0L) add(context.localize(MR.strings.day_short, days)) - if (hours != 0) add(context.localize(MR.strings.hour_short, hours)) - if (minutes != 0 && (days == 0L || hours == 0)) add(context.localize(MR.strings.minute_short, minutes)) - if (seconds != 0 && days == 0L && hours == 0) add(context.localize(MR.strings.seconds_short, seconds)) + if (days != 0L) add(context.stringResource(MR.strings.day_short, days)) + if (hours != 0) add(context.stringResource(MR.strings.hour_short, hours)) + if (minutes != 0 && (days == 0L || hours == 0)) { + 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 } } } @@ -27,8 +31,10 @@ fun Duration.toDurationString(context: Context, fallback: String): String { fun relativeTimeSpanString(epochMillis: Long): String { val now = Date().time return when { - epochMillis <= 0L -> localize(MR.strings.relative_time_span_never) - now - epochMillis < 1.minutes.inWholeMilliseconds -> localize(MR.strings.updates_last_update_info_just_now) + epochMillis <= 0L -> stringResource(MR.strings.relative_time_span_never) + now - epochMillis < 1.minutes.inWholeMilliseconds -> stringResource( + MR.strings.updates_last_update_info_just_now, + ) else -> DateUtils.getRelativeTimeSpanString(epochMillis, now, DateUtils.MINUTE_IN_MILLIS).toString() } } diff --git a/app/src/main/java/eu/kanade/presentation/webview/WebViewScreenContent.kt b/app/src/main/java/eu/kanade/presentation/webview/WebViewScreenContent.kt index f994b75d49..dcfb83534a 100644 --- a/app/src/main/java/eu/kanade/presentation/webview/WebViewScreenContent.kt +++ b/app/src/main/java/eu/kanade/presentation/webview/WebViewScreenContent.kt @@ -43,7 +43,7 @@ import kotlinx.collections.immutable.persistentListOf import kotlinx.coroutines.launch import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.Scaffold -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun WebViewScreenContent( @@ -125,7 +125,7 @@ fun WebViewScreenContent( AppBarActions( persistentListOf( AppBar.Action( - title = localize(MR.strings.action_webview_back), + title = stringResource(MR.strings.action_webview_back), icon = Icons.AutoMirrored.Outlined.ArrowBack, onClick = { if (navigator.canGoBack) { @@ -135,7 +135,7 @@ fun WebViewScreenContent( enabled = navigator.canGoBack, ), AppBar.Action( - title = localize(MR.strings.action_webview_forward), + title = stringResource(MR.strings.action_webview_forward), icon = Icons.AutoMirrored.Outlined.ArrowForward, onClick = { if (navigator.canGoForward) { @@ -145,19 +145,19 @@ fun WebViewScreenContent( enabled = navigator.canGoForward, ), AppBar.OverflowAction( - title = localize(MR.strings.action_webview_refresh), + title = stringResource(MR.strings.action_webview_refresh), onClick = { navigator.reload() }, ), AppBar.OverflowAction( - title = localize(MR.strings.action_share), + title = stringResource(MR.strings.action_share), onClick = { onShare(currentUrl) }, ), AppBar.OverflowAction( - title = localize(MR.strings.action_open_in_browser), + title = stringResource(MR.strings.action_open_in_browser), onClick = { onOpenInBrowser(currentUrl) }, ), AppBar.OverflowAction( - title = localize(MR.strings.pref_clear_cookies), + title = stringResource(MR.strings.pref_clear_cookies), onClick = { onClearCookies(currentUrl) }, ), ), diff --git a/app/src/main/java/eu/kanade/tachiyomi/App.kt b/app/src/main/java/eu/kanade/tachiyomi/App.kt index 65acfe186b..6c293a635c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/App.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/App.kt @@ -55,7 +55,7 @@ import org.acra.config.httpSender import org.acra.ktx.initAcra import org.acra.sender.HttpSender import org.conscrypt.Conscrypt -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.core.util.system.logcat import tachiyomi.i18n.MR import tachiyomi.presentation.widget.WidgetManager @@ -106,8 +106,8 @@ class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory { Notifications.ID_INCOGNITO_MODE, Notifications.CHANNEL_INCOGNITO_MODE, ) { - setContentTitle(localize(MR.strings.pref_incognito_mode)) - setContentText(localize(MR.strings.notification_incognito_text)) + setContentTitle(stringResource(MR.strings.pref_incognito_mode)) + setContentText(stringResource(MR.strings.notification_incognito_text)) setSmallIcon(R.drawable.ic_glasses_24dp) setOngoing(true) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreator.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreator.kt index a6590fa011..ee1894d86a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreator.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreator.kt @@ -37,7 +37,7 @@ import logcat.LogPriority import okio.buffer import okio.gzip import okio.sink -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.core.preference.Preference import tachiyomi.core.preference.PreferenceStore import tachiyomi.core.util.system.logcat @@ -76,7 +76,7 @@ class BackupCreator( */ suspend fun createBackup(uri: Uri, flags: Int, isAutoBackup: Boolean): String { 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() @@ -111,7 +111,7 @@ class BackupCreator( 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) { throw IllegalStateException("Failed to get handle on a backup file") @@ -119,7 +119,7 @@ class BackupCreator( val byteArray = parser.encodeToByteArray(BackupSerializer, backup) if (byteArray.isEmpty()) { - throw IllegalStateException(context.localize(MR.strings.empty_backup_error)) + throw IllegalStateException(context.stringResource(MR.strings.empty_backup_error)) } file.openOutputStream().also { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupFileValidator.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupFileValidator.kt index e883360e03..fdf3d68d99 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupFileValidator.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupFileValidator.kt @@ -4,7 +4,7 @@ import android.content.Context import android.net.Uri import eu.kanade.tachiyomi.data.track.TrackerManager import eu.kanade.tachiyomi.util.BackupUtil -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.domain.source.service.SourceManager import tachiyomi.i18n.MR import uy.kohesive.injekt.Injekt @@ -29,7 +29,7 @@ class BackupFileValidator( } 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 } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupNotifier.kt index a3020c3b32..835796898c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupNotifier.kt @@ -12,8 +12,8 @@ import eu.kanade.tachiyomi.util.storage.getUriCompat import eu.kanade.tachiyomi.util.system.cancelNotification import eu.kanade.tachiyomi.util.system.notificationBuilder import eu.kanade.tachiyomi.util.system.notify -import tachiyomi.core.i18n.localize -import tachiyomi.core.i18n.localizePlural +import tachiyomi.core.i18n.pluralStringResource +import tachiyomi.core.i18n.stringResource import tachiyomi.i18n.MR import uy.kohesive.injekt.injectLazy import java.io.File @@ -47,7 +47,7 @@ class BackupNotifier(private val context: Context) { fun showBackupProgress(): NotificationCompat.Builder { val builder = with(progressNotificationBuilder) { - setContentTitle(context.localize(MR.strings.creating_backup)) + setContentTitle(context.stringResource(MR.strings.creating_backup)) setProgress(0, 0, true) } @@ -61,7 +61,7 @@ class BackupNotifier(private val context: Context) { context.cancelNotification(Notifications.ID_BACKUP_PROGRESS) with(completeNotificationBuilder) { - setContentTitle(context.localize(MR.strings.creating_backup_error)) + setContentTitle(context.stringResource(MR.strings.creating_backup_error)) setContentText(error) show(Notifications.ID_BACKUP_COMPLETE) @@ -72,13 +72,13 @@ class BackupNotifier(private val context: Context) { context.cancelNotification(Notifications.ID_BACKUP_PROGRESS) with(completeNotificationBuilder) { - setContentTitle(context.localize(MR.strings.backup_created)) + setContentTitle(context.stringResource(MR.strings.backup_created)) setContentText(unifile.filePath ?: unifile.name) clearActions() addAction( R.drawable.ic_share_24dp, - context.localize(MR.strings.action_share), + context.stringResource(MR.strings.action_share), NotificationReceiver.shareBackupPendingBroadcast( context, unifile.uri, @@ -92,7 +92,7 @@ class BackupNotifier(private val context: Context) { fun showRestoreProgress( content: String = "", - contentTitle: String = context.localize( + contentTitle: String = context.stringResource( MR.strings.restoring_backup, ), progress: Int = 0, @@ -111,7 +111,7 @@ class BackupNotifier(private val context: Context) { clearActions() addAction( R.drawable.ic_close_24dp, - context.localize(MR.strings.action_cancel), + context.stringResource(MR.strings.action_cancel), NotificationReceiver.cancelRestorePendingBroadcast(context, Notifications.ID_RESTORE_PROGRESS), ) } @@ -125,7 +125,7 @@ class BackupNotifier(private val context: Context) { context.cancelNotification(Notifications.ID_RESTORE_PROGRESS) with(completeNotificationBuilder) { - setContentTitle(context.localize(MR.strings.restoring_backup_error)) + setContentTitle(context.stringResource(MR.strings.restoring_backup_error)) setContentText(error) show(Notifications.ID_RESTORE_COMPLETE) @@ -137,13 +137,13 @@ class BackupNotifier(private val context: Context) { errorCount: Int, path: String?, file: String?, - contentTitle: String = context.localize( + contentTitle: String = context.stringResource( MR.strings.restore_completed, ), ) { context.cancelNotification(Notifications.ID_RESTORE_PROGRESS) - val timeString = context.localize( + val timeString = context.stringResource( MR.strings.restore_duration, TimeUnit.MILLISECONDS.toMinutes(time), TimeUnit.MILLISECONDS.toSeconds(time) - TimeUnit.MINUTES.toSeconds( @@ -154,7 +154,7 @@ class BackupNotifier(private val context: Context) { with(completeNotificationBuilder) { setContentTitle(contentTitle) setContentText( - context.localizePlural( + context.pluralStringResource( MR.plurals.restore_completed_message, errorCount, timeString, @@ -171,7 +171,7 @@ class BackupNotifier(private val context: Context) { setContentIntent(errorLogIntent) addAction( R.drawable.ic_folder_24dp, - context.localize(MR.strings.action_show_errors), + context.stringResource(MR.strings.action_show_errors), errorLogIntent, ) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreJob.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreJob.kt index b05bbb6890..f9b41c3307 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreJob.kt @@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.util.system.isRunning import eu.kanade.tachiyomi.util.system.workManager import kotlinx.coroutines.CancellationException import logcat.LogPriority -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.core.util.system.logcat import tachiyomi.i18n.MR @@ -41,7 +41,7 @@ class BackupRestoreJob(private val context: Context, workerParams: WorkerParamet Result.success() } catch (e: Exception) { if (e is CancellationException) { - notifier.showRestoreError(context.localize(MR.strings.restoring_backup_canceled)) + notifier.showRestoreError(context.stringResource(MR.strings.restoring_backup_canceled)) Result.success() } else { logcat(LogPriority.ERROR, e) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestorer.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestorer.kt index ebd6e07ef8..38b9bf7567 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestorer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestorer.kt @@ -22,7 +22,7 @@ import eu.kanade.tachiyomi.util.BackupUtil import eu.kanade.tachiyomi.util.system.createFileInCacheDir import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.isActive -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.core.preference.AndroidPreferenceStore import tachiyomi.core.preference.PreferenceStore import tachiyomi.data.DatabaseHandler @@ -94,7 +94,7 @@ class BackupRestorer( errors.size, logFile.parent, logFile.name, - contentTitle = context.localize(MR.strings.library_sync_complete), + contentTitle = context.stringResource(MR.strings.library_sync_complete), ) } else { notifier.showRestoreComplete(time, errors.size, logFile.parent, logFile.name) @@ -193,8 +193,8 @@ class BackupRestorer( showRestoreProgress( restoreProgress, restoreAmount, - context.localize(MR.strings.categories), - context.localize(MR.strings.restoring_backup), + context.stringResource(MR.strings.categories), + context.stringResource(MR.strings.restoring_backup), ) } @@ -230,14 +230,14 @@ class BackupRestorer( restoreProgress, restoreAmount, manga.title, - context.localize(MR.strings.syncing_library), + context.stringResource(MR.strings.syncing_library), ) } else { showRestoreProgress( restoreProgress, restoreAmount, manga.title, - context.localize(MR.strings.restoring_backup), + context.stringResource(MR.strings.restoring_backup), ) } } @@ -634,8 +634,8 @@ class BackupRestorer( showRestoreProgress( restoreProgress, restoreAmount, - context.localize(MR.strings.app_settings), - context.localize(MR.strings.restoring_backup), + context.stringResource(MR.strings.app_settings), + context.stringResource(MR.strings.restoring_backup), ) } @@ -649,8 +649,8 @@ class BackupRestorer( showRestoreProgress( restoreProgress, restoreAmount, - context.localize(MR.strings.source_settings), - context.localize(MR.strings.restoring_backup), + context.stringResource(MR.strings.source_settings), + context.stringResource(MR.strings.restoring_backup), ) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt index 7f82fdfa19..0b404165fc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt @@ -14,7 +14,7 @@ import kotlinx.coroutines.flow.merge import kotlinx.coroutines.flow.onStart import kotlinx.coroutines.runBlocking import logcat.LogPriority -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.core.util.lang.launchIO import tachiyomi.core.util.system.logcat import tachiyomi.domain.category.interactor.GetCategories @@ -159,7 +159,7 @@ class DownloadManager( .filter { "image" in it.type.orEmpty() } if (files.isEmpty()) { - throw Exception(context.localize(MR.strings.page_list_empty_error)) + throw Exception(context.stringResource(MR.strings.page_list_empty_error)) } return files.sortedBy { it.name } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt index aac539e073..0d9f6152a7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt @@ -14,7 +14,7 @@ import eu.kanade.tachiyomi.util.lang.chop import eu.kanade.tachiyomi.util.system.cancelNotification 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 import uy.kohesive.injekt.injectLazy import java.util.regex.Pattern @@ -80,12 +80,12 @@ internal class DownloadNotifier(private val context: Context) { // Pause action addAction( R.drawable.ic_pause_24dp, - context.localize(MR.strings.action_pause), + context.stringResource(MR.strings.action_pause), NotificationReceiver.pauseDownloadsPendingBroadcast(context), ) } - val downloadingProgressText = context.localize( + val downloadingProgressText = context.stringResource( MR.strings.chapter_downloading_progress, download.downloadedImages, download.pages!!.size, @@ -117,8 +117,8 @@ internal class DownloadNotifier(private val context: Context) { */ fun onPaused() { with(progressNotificationBuilder) { - setContentTitle(context.localize(MR.strings.chapter_paused)) - setContentText(context.localize(MR.strings.download_notifier_download_paused)) + setContentTitle(context.stringResource(MR.strings.chapter_paused)) + setContentText(context.stringResource(MR.strings.download_notifier_download_paused)) setSmallIcon(R.drawable.ic_pause_24dp) setProgress(0, 0, false) setOngoing(false) @@ -128,13 +128,13 @@ internal class DownloadNotifier(private val context: Context) { // Resume action addAction( R.drawable.ic_play_arrow_24dp, - context.localize(MR.strings.action_resume), + context.stringResource(MR.strings.action_resume), NotificationReceiver.resumeDownloadsPendingBroadcast(context), ) // Clear action addAction( R.drawable.ic_close_24dp, - context.localize(MR.strings.action_cancel_all), + context.stringResource(MR.strings.action_cancel_all), NotificationReceiver.clearDownloadsPendingBroadcast(context), ) @@ -164,7 +164,7 @@ internal class DownloadNotifier(private val context: Context) { */ fun onWarning(reason: String, timeout: Long? = null, contentIntent: PendingIntent? = null) { 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)) setSmallIcon(R.drawable.ic_warning_white_24dp) setAutoCancel(true) @@ -192,9 +192,9 @@ internal class DownloadNotifier(private val context: Context) { // Create notification with(errorNotificationBuilder) { 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) clearActions() setContentIntent(NotificationHandler.openDownloadManagerPendingActivity(context)) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt index ef31b88fcf..cdf86836a4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt @@ -9,7 +9,7 @@ import kotlinx.coroutines.MainScope import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import logcat.LogPriority -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.core.util.system.logcat import tachiyomi.domain.chapter.model.Chapter import tachiyomi.domain.download.service.DownloadPreferences @@ -59,7 +59,7 @@ class DownloadProvider( .createDirectory(getMangaDirName(mangaTitle)) } catch (e: Throwable) { 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)) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadService.kt index 315a51cdf7..9ce5c5b2a3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadService.kt @@ -26,7 +26,7 @@ import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import logcat.LogPriority 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.system.logcat import tachiyomi.domain.download.service.DownloadPreferences @@ -113,7 +113,7 @@ class DownloadService : Service() { } private fun downloaderStop(string: StringResource) { - downloadManager.downloaderStop(localize(string)) + downloadManager.downloaderStop(stringResource(string)) } private fun listenNetworkChanges() { @@ -145,7 +145,7 @@ class DownloadService : Service() { private fun getPlaceholderNotification(): Notification { return notificationBuilder(Notifications.CHANNEL_DOWNLOADER_PROGRESS) { - setContentTitle(localize(MR.strings.download_notifier_downloader_title)) + setContentTitle(stringResource(MR.strings.download_notifier_downloader_title)) }.build() } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt index bcd7460094..f89146e3a0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt @@ -40,7 +40,7 @@ import kotlinx.coroutines.supervisorScope import logcat.LogPriority import nl.adaptivity.xmlutil.serialization.XML import okhttp3.Response -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.core.metadata.comicinfo.COMIC_INFO_FILE import tachiyomi.core.metadata.comicinfo.ComicInfo import tachiyomi.core.util.lang.launchIO @@ -303,7 +303,7 @@ class Downloader( ) { withUIContext { notifier.onWarning( - context.localize(MR.strings.download_queue_size_warning), + context.stringResource(MR.strings.download_queue_size_warning), WARNING_NOTIF_TIMEOUT_MS, NotificationHandler.openUrl(context, LibraryUpdateNotifier.HELP_WARNING_URL), ) @@ -326,7 +326,7 @@ class Downloader( if (availSpace != -1L && availSpace < MIN_DISK_SPACE) { download.status = Download.State.ERROR notifier.onError( - context.localize(MR.strings.download_insufficient_space), + context.stringResource(MR.strings.download_insufficient_space), download.chapter.name, download.manga.title, ) @@ -343,7 +343,7 @@ class Downloader( val pages = download.source.getPageList(download.chapter.toSChapter()) if (pages.isEmpty()) { - throw Exception(context.localize(MR.strings.page_list_empty_error)) + throw Exception(context.stringResource(MR.strings.page_list_empty_error)) } // Don't trust index from source val reIndexedPages = pages.mapIndexed { index, page -> Page(index, page.url, page.imageUrl, page.uri) } @@ -547,7 +547,7 @@ class Downloader( try { val filenamePrefix = String.format("%03d", page.number) val imageFile = tmpDir.listFiles()?.firstOrNull { it.name.orEmpty().startsWith(filenamePrefix) } - ?: error(context.localize(MR.strings.download_notifier_split_page_not_found, page.number)) + ?: error(context.stringResource(MR.strings.download_notifier_split_page_not_found, page.number)) // If the original page was previously split, then skip if (imageFile.name.orEmpty().startsWith("${filenamePrefix}__")) return diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt index 408ab67c46..89fd40dcc5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt @@ -38,7 +38,7 @@ import kotlinx.coroutines.runBlocking import kotlinx.coroutines.sync.Semaphore import kotlinx.coroutines.sync.withPermit import logcat.LogPriority -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.core.preference.getAndSet import tachiyomi.core.util.lang.withIOContext import tachiyomi.core.util.system.logcat @@ -181,28 +181,30 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet .filter { when { it.manga.updateStrategy != UpdateStrategy.ALWAYS_UPDATE -> { - skippedUpdates.add(it.manga to context.localize(MR.strings.skipped_reason_not_always_update)) + skippedUpdates.add( + it.manga to context.stringResource(MR.strings.skipped_reason_not_always_update), + ) false } MANGA_NON_COMPLETED in restrictions && it.manga.status.toInt() == SManga.COMPLETED -> { - skippedUpdates.add(it.manga to context.localize(MR.strings.skipped_reason_completed)) + skippedUpdates.add(it.manga to context.stringResource(MR.strings.skipped_reason_completed)) false } MANGA_HAS_UNREAD in restrictions && it.unreadCount != 0L -> { - skippedUpdates.add(it.manga to context.localize(MR.strings.skipped_reason_not_caught_up)) + skippedUpdates.add(it.manga to context.stringResource(MR.strings.skipped_reason_not_caught_up)) false } MANGA_NON_READ in restrictions && it.totalChapters > 0L && !it.hasStarted -> { - skippedUpdates.add(it.manga to context.localize(MR.strings.skipped_reason_not_started)) + skippedUpdates.add(it.manga to context.stringResource(MR.strings.skipped_reason_not_started)) false } MANGA_OUTSIDE_RELEASE_PERIOD in restrictions && it.manga.nextUpdate > fetchWindow.second -> { skippedUpdates.add( - it.manga to context.localize(MR.strings.skipped_reason_not_in_release_period), + it.manga to context.stringResource(MR.strings.skipped_reason_not_in_release_period), ) false } @@ -287,9 +289,11 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet } } catch (e: Throwable) { val errorMessage = when (e) { - is NoChaptersException -> context.localize(MR.strings.no_chapters_error) + is NoChaptersException -> context.stringResource( + MR.strings.no_chapters_error, + ) // failedUpdates will already have the source, don't need to copy it into the message - is SourceNotInstalledException -> context.localize( + is SourceNotInstalledException -> context.stringResource( MR.strings.loader_not_implemented_error, ) else -> e.message @@ -388,7 +392,7 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet if (errors.isNotEmpty()) { val file = context.createFileInCacheDir("tachiyomi_update_errors.txt") file.bufferedWriter().use { out -> - out.write(context.localize(MR.strings.library_errors_help, ERROR_LOG_HELP_URL) + "\n\n") + out.write(context.stringResource(MR.strings.library_errors_help, ERROR_LOG_HELP_URL) + "\n\n") // Error file format: // ! Error // # Source diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt index 65ee7ee06a..4a21b9bc0a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt @@ -26,8 +26,8 @@ import eu.kanade.tachiyomi.util.system.getBitmapOrNull import eu.kanade.tachiyomi.util.system.notificationBuilder import eu.kanade.tachiyomi.util.system.notify import tachiyomi.core.Constants -import tachiyomi.core.i18n.localize -import tachiyomi.core.i18n.localizePlural +import tachiyomi.core.i18n.pluralStringResource +import tachiyomi.core.i18n.stringResource import tachiyomi.core.util.lang.launchUI import tachiyomi.domain.chapter.model.Chapter import tachiyomi.domain.manga.model.Manga @@ -61,12 +61,12 @@ class LibraryUpdateNotifier(private val context: Context) { */ val progressNotificationBuilder by lazy { context.notificationBuilder(Notifications.CHANNEL_LIBRARY_PROGRESS) { - setContentTitle(context.localize(MR.strings.app_name)) + setContentTitle(context.stringResource(MR.strings.app_name)) setSmallIcon(R.drawable.ic_refresh_24dp) setLargeIcon(notificationBitmap) setOngoing(true) setOnlyAlertOnce(true) - addAction(R.drawable.ic_close_24dp, context.localize(MR.strings.action_cancel), cancelIntent) + addAction(R.drawable.ic_close_24dp, context.stringResource(MR.strings.action_cancel), cancelIntent) } } @@ -80,13 +80,13 @@ class LibraryUpdateNotifier(private val context: Context) { fun showProgressNotification(manga: List, current: Int, total: Int) { if (preferences.hideNotificationContent().get()) { progressNotificationBuilder - .setContentTitle(context.localize(MR.strings.notification_check_updates)) + .setContentTitle(context.stringResource(MR.strings.notification_check_updates)) .setContentText("($current/$total)") } else { val updatingText = manga.joinToString("\n") { it.title.chop(40) } progressNotificationBuilder .setContentTitle( - context.localize( + context.stringResource( MR.strings.notification_updating_progress, percentFormatter.format(current.toFloat() / total), ), @@ -107,8 +107,10 @@ class LibraryUpdateNotifier(private val context: Context) { Notifications.ID_LIBRARY_SIZE_WARNING, Notifications.CHANNEL_LIBRARY_PROGRESS, ) { - setContentTitle(context.localize(MR.strings.label_warning)) - setStyle(NotificationCompat.BigTextStyle().bigText(context.localize(MR.strings.notification_size_warning))) + setContentTitle(context.stringResource(MR.strings.label_warning)) + setStyle( + NotificationCompat.BigTextStyle().bigText(context.stringResource(MR.strings.notification_size_warning)), + ) setSmallIcon(R.drawable.ic_warning_white_24dp) setTimeoutAfter(Downloader.WARNING_NOTIF_TIMEOUT_MS) setContentIntent(NotificationHandler.openUrl(context, HELP_WARNING_URL)) @@ -130,8 +132,8 @@ class LibraryUpdateNotifier(private val context: Context) { Notifications.ID_LIBRARY_ERROR, Notifications.CHANNEL_LIBRARY_ERROR, ) { - setContentTitle(context.localize(MR.strings.notification_update_error, failed)) - setContentText(context.localize(MR.strings.action_show_errors)) + setContentTitle(context.stringResource(MR.strings.notification_update_error, failed)) + setContentText(context.stringResource(MR.strings.action_show_errors)) setSmallIcon(R.drawable.ic_tachi) setContentIntent(NotificationReceiver.openErrorLogPendingActivity(context, uri)) @@ -152,8 +154,8 @@ class LibraryUpdateNotifier(private val context: Context) { Notifications.ID_LIBRARY_SKIPPED, Notifications.CHANNEL_LIBRARY_SKIPPED, ) { - setContentTitle(context.localize(MR.strings.notification_update_skipped, skipped)) - setContentText(context.localize(MR.strings.learn_more)) + setContentTitle(context.stringResource(MR.strings.notification_update_skipped, skipped)) + setContentText(context.stringResource(MR.strings.learn_more)) setSmallIcon(R.drawable.ic_tachi) setContentIntent(NotificationHandler.openUrl(context, HELP_SKIPPED_URL)) } @@ -170,12 +172,12 @@ class LibraryUpdateNotifier(private val context: Context) { Notifications.ID_NEW_CHAPTERS, Notifications.CHANNEL_NEW_CHAPTERS, ) { - setContentTitle(context.localize(MR.strings.notification_new_chapters)) + setContentTitle(context.stringResource(MR.strings.notification_new_chapters)) if (updates.size == 1 && !preferences.hideNotificationContent().get()) { setContentText(updates.first().first.title.chop(NOTIF_TITLE_MAX_LEN)) } else { setContentText( - context.localizePlural( + context.pluralStringResource( MR.plurals.notification_new_chapters_summary, updates.size, updates.size, @@ -246,7 +248,7 @@ class LibraryUpdateNotifier(private val context: Context) { // Mark chapters as read action addAction( R.drawable.ic_glasses_24dp, - context.localize(MR.strings.action_mark_as_read), + context.stringResource(MR.strings.action_mark_as_read), NotificationReceiver.markAsReadPendingBroadcast( context, manga, @@ -257,7 +259,7 @@ class LibraryUpdateNotifier(private val context: Context) { // View chapters action addAction( R.drawable.ic_book_24dp, - context.localize(MR.strings.action_view_chapters), + context.stringResource(MR.strings.action_view_chapters), NotificationReceiver.openChapterPendingActivity( context, manga, @@ -269,7 +271,7 @@ class LibraryUpdateNotifier(private val context: Context) { if (chapters.size <= Downloader.CHAPTERS_PER_SOURCE_QUEUE_WARNING_THRESHOLD) { addAction( android.R.drawable.stat_sys_download_done, - context.localize(MR.strings.action_download), + context.stringResource(MR.strings.action_download), NotificationReceiver.downloadChaptersPendingBroadcast( context, manga, @@ -309,7 +311,7 @@ class LibraryUpdateNotifier(private val context: Context) { // No sensible chapter numbers to show (i.e. no chapters have parsed chapter number) 0 -> { // "1 new chapter" or "5 new chapters" - context.localizePlural( + context.pluralStringResource( MR.plurals.notification_chapters_generic, chapters.size, chapters.size, @@ -320,13 +322,13 @@ class LibraryUpdateNotifier(private val context: Context) { val remaining = chapters.size - displayableChapterNumbers.size if (remaining == 0) { // "Chapter 2.5" - context.localize( + context.stringResource( MR.strings.notification_chapters_single, displayableChapterNumbers.first(), ) } else { // "Chapter 2.5 and 10 more" - context.localize( + context.stringResource( MR.strings.notification_chapters_single_and_more, displayableChapterNumbers.first(), remaining, @@ -342,7 +344,7 @@ class LibraryUpdateNotifier(private val context: Context) { val joinedChapterNumbers = displayableChapterNumbers .take(NOTIF_MAX_CHAPTERS) .joinToString(", ") - context.localizePlural( + context.pluralStringResource( MR.plurals.notification_chapters_multiple_and_more, remaining, joinedChapterNumbers, @@ -350,7 +352,7 @@ class LibraryUpdateNotifier(private val context: Context) { ) } else { // "Chapters 1, 2.5, 3" - context.localize( + context.stringResource( MR.strings.notification_chapters_multiple, displayableChapterNumbers.joinToString(", "), ) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/notification/Notifications.kt b/app/src/main/java/eu/kanade/tachiyomi/data/notification/Notifications.kt index a2a5d49c49..3a76b045d4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/notification/Notifications.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/notification/Notifications.kt @@ -7,7 +7,7 @@ import androidx.core.app.NotificationManagerCompat.IMPORTANCE_HIGH import androidx.core.app.NotificationManagerCompat.IMPORTANCE_LOW import eu.kanade.tachiyomi.util.system.buildNotificationChannel import eu.kanade.tachiyomi.util.system.buildNotificationChannelGroup -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.i18n.MR /** @@ -103,16 +103,16 @@ object Notifications { notificationManager.createNotificationChannelGroupsCompat( listOf( buildNotificationChannelGroup(GROUP_BACKUP_RESTORE) { - setName(context.localize(MR.strings.label_backup)) + setName(context.stringResource(MR.strings.label_backup)) }, buildNotificationChannelGroup(GROUP_DOWNLOADER) { - setName(context.localize(MR.strings.download_notifier_downloader_title)) + setName(context.stringResource(MR.strings.download_notifier_downloader_title)) }, buildNotificationChannelGroup(GROUP_LIBRARY) { - setName(context.localize(MR.strings.label_library)) + setName(context.stringResource(MR.strings.label_library)) }, 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( listOf( 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) { - setName(context.localize(MR.strings.channel_progress)) + setName(context.stringResource(MR.strings.channel_progress)) setGroup(GROUP_LIBRARY) setShowBadge(false) }, buildNotificationChannel(CHANNEL_LIBRARY_ERROR, IMPORTANCE_LOW) { - setName(context.localize(MR.strings.channel_errors)) + setName(context.stringResource(MR.strings.channel_errors)) setGroup(GROUP_LIBRARY) setShowBadge(false) }, buildNotificationChannel(CHANNEL_LIBRARY_SKIPPED, IMPORTANCE_LOW) { - setName(context.localize(MR.strings.channel_skipped)) + setName(context.stringResource(MR.strings.channel_skipped)) setGroup(GROUP_LIBRARY) setShowBadge(false) }, 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) { - setName(context.localize(MR.strings.channel_progress)) + setName(context.stringResource(MR.strings.channel_progress)) setGroup(GROUP_DOWNLOADER) setShowBadge(false) }, buildNotificationChannel(CHANNEL_DOWNLOADER_ERROR, IMPORTANCE_LOW) { - setName(context.localize(MR.strings.channel_errors)) + setName(context.stringResource(MR.strings.channel_errors)) setGroup(GROUP_DOWNLOADER) setShowBadge(false) }, 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) setShowBadge(false) }, 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) setShowBadge(false) setSound(null, null) }, 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) { 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) { setGroup(GROUP_APK_UPDATES) - setName(context.localize(MR.strings.channel_ext_updates)) + setName(context.stringResource(MR.strings.channel_ext_updates)) }, ), ) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/saver/ImageSaver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/saver/ImageSaver.kt index 2da5ccfd15..85afc0b23a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/saver/ImageSaver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/saver/ImageSaver.kt @@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.util.storage.cacheImageDir import eu.kanade.tachiyomi.util.storage.getUriCompat import logcat.LogPriority import okio.IOException -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.core.util.system.ImageUtil import tachiyomi.core.util.system.logcat import tachiyomi.i18n.MR @@ -71,7 +71,7 @@ class ImageSaver( val imageLocation = (image.location as Location.Pictures).relativePath val relativePath = listOf( Environment.DIRECTORY_PICTURES, - context.localize(MR.strings.app_name), + context.stringResource(MR.strings.app_name), imageLocation, ).joinToString(File.separator) @@ -86,7 +86,7 @@ class ImageSaver( context.contentResolver.insert( pictureDir, contentValues, - ) ?: throw IOException(context.localize(MR.strings.error_saving_picture)) + ) ?: throw IOException(context.stringResource(MR.strings.error_saving_picture)) } try { @@ -97,7 +97,7 @@ class ImageSaver( } } catch (e: Exception) { 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) @@ -185,7 +185,7 @@ sealed interface Location { is Pictures -> { val file = File( Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), - context.localize(MR.strings.app_name), + context.stringResource(MR.strings.app_name), ) if (relativePath.isNotEmpty()) { return File( diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateDownloadJob.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateDownloadJob.kt index 5c54e38c02..581f15a12c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateDownloadJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateDownloadJob.kt @@ -21,7 +21,7 @@ import eu.kanade.tachiyomi.util.system.workManager import logcat.LogPriority import okhttp3.internal.http2.ErrorCode 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.system.logcat import tachiyomi.i18n.MR @@ -37,7 +37,7 @@ class AppUpdateDownloadJob(private val context: Context, workerParams: WorkerPar override suspend fun doWork(): Result { 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()) { return Result.failure() diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateNotifier.kt index 234532afdf..dd7b8a68bf 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateNotifier.kt @@ -13,7 +13,7 @@ import eu.kanade.tachiyomi.data.notification.NotificationReceiver import eu.kanade.tachiyomi.data.notification.Notifications 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.domain.release.model.Release import tachiyomi.i18n.MR @@ -53,7 +53,7 @@ internal class AppUpdateNotifier(private val context: Context) { } 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) setSmallIcon(android.R.drawable.stat_sys_download_done) setContentIntent(updateIntent) @@ -61,12 +61,12 @@ internal class AppUpdateNotifier(private val context: Context) { clearActions() addAction( android.R.drawable.stat_sys_download_done, - context.localize(MR.strings.action_download), + context.stringResource(MR.strings.action_download), updateIntent, ) addAction( R.drawable.ic_info_24dp, - context.localize(MR.strings.whats_new), + context.stringResource(MR.strings.whats_new), releaseIntent, ) } @@ -81,14 +81,14 @@ internal class AppUpdateNotifier(private val context: Context) { fun onDownloadStarted(title: String? = null): NotificationCompat.Builder { with(notificationBuilder) { 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) setOngoing(true) clearActions() addAction( R.drawable.ic_close_24dp, - context.localize(MR.strings.action_cancel), + context.stringResource(MR.strings.action_cancel), NotificationReceiver.cancelDownloadAppUpdatePendingBroadcast(context), ) } @@ -117,7 +117,7 @@ internal class AppUpdateNotifier(private val context: Context) { fun promptInstall(uri: Uri) { val installIntent = NotificationHandler.installApkPendingActivity(context, uri) 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) setOnlyAlertOnce(false) setProgress(0, 0, false) @@ -127,12 +127,12 @@ internal class AppUpdateNotifier(private val context: Context) { clearActions() addAction( R.drawable.ic_system_update_alt_white_24dp, - context.localize(MR.strings.action_install), + context.stringResource(MR.strings.action_install), installIntent, ) addAction( 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), ) } @@ -147,8 +147,8 @@ internal class AppUpdateNotifier(private val context: Context) { */ fun promptFdroidUpdate() { with(notificationBuilder) { - setContentTitle(context.localize(MR.strings.update_check_notification_update_available)) - setContentText(context.localize(MR.strings.update_check_fdroid_migration_info)) + setContentTitle(context.stringResource(MR.strings.update_check_notification_update_available)) + setContentText(context.stringResource(MR.strings.update_check_fdroid_migration_info)) setSmallIcon(R.drawable.ic_tachi) setContentIntent( NotificationHandler.openUrl( @@ -167,7 +167,7 @@ internal class AppUpdateNotifier(private val context: Context) { */ fun onDownloadError(url: String) { 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) setOnlyAlertOnce(false) setProgress(0, 0, false) @@ -175,12 +175,12 @@ internal class AppUpdateNotifier(private val context: Context) { clearActions() addAction( R.drawable.ic_refresh_24dp, - context.localize(MR.strings.action_retry), + context.stringResource(MR.strings.action_retry), NotificationReceiver.downloadAppUpdatePendingBroadcast(context, url), ) addAction( R.drawable.ic_close_24dp, - context.localize(MR.strings.action_cancel), + context.stringResource(MR.strings.action_cancel), NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_APP_UPDATER), ) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionUpdateNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionUpdateNotifier.kt index de9739ddef..602ce80f9d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionUpdateNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionUpdateNotifier.kt @@ -7,7 +7,7 @@ import eu.kanade.tachiyomi.data.notification.NotificationReceiver import eu.kanade.tachiyomi.data.notification.Notifications import eu.kanade.tachiyomi.util.system.cancelNotification import eu.kanade.tachiyomi.util.system.notify -import tachiyomi.core.i18n.localizePlural +import tachiyomi.core.i18n.pluralStringResource import tachiyomi.i18n.MR class ExtensionUpdateNotifier(private val context: Context) { @@ -18,7 +18,7 @@ class ExtensionUpdateNotifier(private val context: Context) { Notifications.CHANNEL_EXTENSIONS_UPDATE, ) { setContentTitle( - context.localizePlural( + context.pluralStringResource( MR.plurals.update_check_notification_ext_updates, names.size, names.size, diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallService.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallService.kt index f75c9e9512..826db44cdc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallService.kt @@ -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.notificationBuilder import logcat.LogPriority -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.core.util.system.logcat import tachiyomi.i18n.MR @@ -29,7 +29,7 @@ class ExtensionInstallService : Service() { setAutoCancel(false) setOngoing(true) setShowWhen(false) - setContentTitle(localize(MR.strings.ext_install_service_notif)) + setContentTitle(stringResource(MR.strings.ext_install_service_notif)) setProgress(100, 100, true) }.build() startForeground(Notifications.ID_EXTENSION_INSTALLER, notification) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/BrowseTab.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/BrowseTab.kt index 7e23ca9a30..a05cba6202 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/BrowseTab.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/BrowseTab.kt @@ -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), ) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionFilterScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionFilterScreen.kt index f332424da1..9fd5df0fd7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionFilterScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionFilterScreen.kt @@ -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) } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionsTab.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionsTab.kt index 94726ac34a..cb72b5f66e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionsTab.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionsTab.kt @@ -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()) }, ), diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateDialog.kt index d9ddc97a20..9e87e8989e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateDialog.kt @@ -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)) } } }, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SourceSearchScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SourceSearchScreen.kt index b3eacd5287..0bbe49b0ae 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SourceSearchScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SourceSearchScreen.kt @@ -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, ) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrateSourceTab.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrateSourceTab.kt index eb36ce6ffd..aaf47a3afb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrateSourceTab.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrateSourceTab.kt @@ -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") diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourcesTab.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourcesTab.kt index 5fdd9d7fbf..f644f8c8da 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourcesTab.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourcesTab.kt @@ -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) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreen.kt index 69b4d20cbb..400b5215a7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreen.kt @@ -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)) }, ) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceFilterDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceFilterDialog.kt index 6a73bbd8ad..9c4c5a2726 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceFilterDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceFilterDialog.kt @@ -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() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/deeplink/DeepLinkScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/deeplink/DeepLinkScreen.kt index c4b166cb75..bd67cae6af 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/deeplink/DeepLinkScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/deeplink/DeepLinkScreen.kt @@ -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, ) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadQueueScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadQueueScreen.kt index 938b49e88a..f8470ef7ba 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadQueueScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadQueueScreen.kt @@ -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) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/history/HistoryTab.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/history/HistoryTab.kt index c813343eea..0c6e283ca3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/history/HistoryTab.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/history/HistoryTab.kt @@ -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)) } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/home/HomeScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/home/HomeScreen.kt index c4aecb8c4e..236e80f83c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/home/HomeScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/home/HomeScreen.kt @@ -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, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryTab.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryTab.kt index e6a79582e7..0721b7132c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryTab.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryTab.kt @@ -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 diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 4ebf3891f7..998781730a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -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)) } }, ) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaCoverScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaCoverScreenModel.kt index 1bf3738667..6a4d968a4e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaCoverScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaCoverScreenModel.kt @@ -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) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt index 60065bae5a..f792581de5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt @@ -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), ), ) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt index 68c674299e..e49394b0f7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt @@ -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)) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackInfoDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackInfoDialog.kt index 64d281f7c9..ce6f27686b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackInfoDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackInfoDialog.kt @@ -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)) } } }, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreTab.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreTab.kt index 28bc495839..8d5fa13135 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreTab.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreTab.kt @@ -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), ) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index 0a931611a6..f5b647e851 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -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))) } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavigationOverlayView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavigationOverlayView.kt index af121a27cc..70aa7bfb0e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavigationOverlayView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavigationOverlayView.kt @@ -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) } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/SaveImageNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/SaveImageNotifier.kt index 2ea8b319f9..56813b7142 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/SaveImageNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/SaveImageNotifier.kt @@ -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), ) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt index 942e7542c7..4989b4704e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt @@ -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)) } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerTransitionHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerTransitionHolder.kt index f4a406056a..6adb5fcef1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerTransitionHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerTransitionHolder.kt @@ -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) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonTransitionHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonTransitionHolder.kt index e9b62a93be..65629799e4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonTransitionHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonTransitionHolder.kt @@ -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) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/security/UnlockActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/security/UnlockActivity.kt index 1fb2f47474..557da5bdd5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/security/UnlockActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/security/UnlockActivity.kt @@ -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( diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/stats/StatsScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/stats/StatsScreen.kt index ba1100ec9a..82f1f2ab2d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/stats/StatsScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/stats/StatsScreen.kt @@ -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, ) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/updates/UpdatesTab.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/updates/UpdatesTab.kt index ace03d0280..9703b5fcf6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/updates/UpdatesTab.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/updates/UpdatesTab.kt @@ -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)) } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/lang/DateExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/lang/DateExtensions.kt index bf1207c005..7d974a40b6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/lang/DateExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/lang/DateExtensions.kt @@ -1,8 +1,8 @@ package eu.kanade.tachiyomi.util.lang import android.content.Context -import tachiyomi.core.i18n.localize -import tachiyomi.core.i18n.localizePlural +import tachiyomi.core.i18n.pluralStringResource +import tachiyomi.core.i18n.stringResource import tachiyomi.i18n.MR import java.text.DateFormat import java.time.Instant @@ -63,8 +63,8 @@ fun Date.toRelativeString( val days = difference.floorDiv(MILLISECONDS_IN_DAY).toInt() return when { difference < 0 -> dateFormat.format(this) - difference < MILLISECONDS_IN_DAY -> context.localize(MR.strings.relative_time_today) - difference < MILLISECONDS_IN_DAY.times(7) -> context.localizePlural( + difference < MILLISECONDS_IN_DAY -> context.stringResource(MR.strings.relative_time_today) + difference < MILLISECONDS_IN_DAY.times(7) -> context.pluralStringResource( MR.plurals.relative_time, days, days, diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/AuthenticatorUtil.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/AuthenticatorUtil.kt index 6de909fadf..ce3a091417 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/AuthenticatorUtil.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/AuthenticatorUtil.kt @@ -11,7 +11,7 @@ import androidx.biometric.auth.startClass2BiometricOrCredentialAuthentication import androidx.core.content.ContextCompat import androidx.fragment.app.FragmentActivity import kotlinx.coroutines.suspendCancellableCoroutine -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.i18n.MR import kotlin.coroutines.resume @@ -49,7 +49,7 @@ object AuthenticatorUtil { suspend fun FragmentActivity.authenticate( title: String, - subtitle: String? = localize(MR.strings.confirm_lock_change), + subtitle: String? = stringResource(MR.strings.confirm_lock_change), ): Boolean = suspendCancellableCoroutine { cont -> if (!isAuthenticationSupported()) { cont.resume(true) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt index 644c7f1021..14f6373664 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt @@ -24,7 +24,7 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences import eu.kanade.tachiyomi.util.lang.truncateCenter import logcat.LogPriority import rikka.sui.Sui -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.core.util.system.logcat import tachiyomi.i18n.MR import uy.kohesive.injekt.Injekt @@ -47,7 +47,7 @@ fun Context.copyToClipboard(label: String, content: String) { // Android 13 and higher shows a visual confirmation of copied contents // https://developer.android.com/about/versions/13/features/copy-paste if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) { - toast(localize(MR.strings.copied_to_clipboard, content.truncateCenter(50))) + toast(stringResource(MR.strings.copied_to_clipboard, content.truncateCenter(50))) } } catch (e: Throwable) { logcat(LogPriority.ERROR, e) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/IntentExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/IntentExtensions.kt index 0388392d7e..ed4ce04f53 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/IntentExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/IntentExtensions.kt @@ -6,7 +6,7 @@ import android.content.Intent import android.net.Uri import android.os.Build import androidx.core.content.IntentCompat -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.i18n.MR import java.io.Serializable @@ -28,7 +28,7 @@ fun Uri.toShareIntent(context: Context, type: String = "image/*", message: Strin flags = Intent.FLAG_GRANT_READ_URI_PERMISSION } - return Intent.createChooser(shareIntent, context.localize(MR.strings.action_share)).apply { + return Intent.createChooser(shareIntent, context.stringResource(MR.strings.action_share)).apply { flags = Intent.FLAG_ACTIVITY_NEW_TASK } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/LocaleHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/LocaleHelper.kt index 3afa3069ce..cdd5448f7b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/LocaleHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/LocaleHelper.kt @@ -3,7 +3,7 @@ package eu.kanade.tachiyomi.util.system import android.content.Context import androidx.core.os.LocaleListCompat import eu.kanade.tachiyomi.ui.browse.source.SourcesScreenModel -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.i18n.MR import java.util.Locale @@ -30,10 +30,10 @@ object LocaleHelper { */ fun getSourceDisplayName(lang: String?, context: Context): String { return when (lang) { - SourcesScreenModel.LAST_USED_KEY -> context.localize(MR.strings.last_used_source) - SourcesScreenModel.PINNED_KEY -> context.localize(MR.strings.pinned_sources) - "other" -> context.localize(MR.strings.other_source) - "all" -> context.localize(MR.strings.multi_lang) + SourcesScreenModel.LAST_USED_KEY -> context.stringResource(MR.strings.last_used_source) + SourcesScreenModel.PINNED_KEY -> context.stringResource(MR.strings.pinned_sources) + "other" -> context.stringResource(MR.strings.other_source) + "all" -> context.stringResource(MR.strings.multi_lang) else -> getDisplayName(lang) } } diff --git a/core/src/main/java/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt b/core/src/main/java/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt index 989621375d..12a8f0ce04 100644 --- a/core/src/main/java/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt +++ b/core/src/main/java/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt @@ -14,7 +14,7 @@ import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.Interceptor import okhttp3.Request import okhttp3.Response -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.i18n.MR import java.io.IOException import java.util.concurrent.CountDownLatch @@ -49,7 +49,7 @@ class CloudflareInterceptor( // Because OkHttp's enqueue only handles IOExceptions, wrap the exception so that // we don't crash the entire app catch (e: CloudflareBypassException) { - throw IOException(context.localize(MR.strings.information_cloudflare_bypass_failure), e) + throw IOException(context.stringResource(MR.strings.information_cloudflare_bypass_failure), e) } catch (e: Exception) { throw IOException(e) } diff --git a/core/src/main/java/eu/kanade/tachiyomi/util/system/ToastExtensions.kt b/core/src/main/java/eu/kanade/tachiyomi/util/system/ToastExtensions.kt index 48dca9a96f..0f4aba9bf4 100644 --- a/core/src/main/java/eu/kanade/tachiyomi/util/system/ToastExtensions.kt +++ b/core/src/main/java/eu/kanade/tachiyomi/util/system/ToastExtensions.kt @@ -3,7 +3,7 @@ package eu.kanade.tachiyomi.util.system import android.content.Context import android.widget.Toast import dev.icerock.moko.resources.StringResource -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource /** * Display a toast in this context. @@ -16,7 +16,7 @@ fun Context.toast( duration: Int = Toast.LENGTH_SHORT, block: (Toast) -> Unit = {}, ): Toast { - return toast(localize(resource), duration, block) + return toast(stringResource(resource), duration, block) } /** diff --git a/core/src/main/java/tachiyomi/core/i18n/Localize.kt b/core/src/main/java/tachiyomi/core/i18n/Localize.kt index 07e2878ddc..3c0c7e2169 100644 --- a/core/src/main/java/tachiyomi/core/i18n/Localize.kt +++ b/core/src/main/java/tachiyomi/core/i18n/Localize.kt @@ -9,18 +9,18 @@ import dev.icerock.moko.resources.desc.Resource import dev.icerock.moko.resources.desc.ResourceFormatted import dev.icerock.moko.resources.desc.StringDesc -fun Context.localize(resource: StringResource): String { +fun Context.stringResource(resource: StringResource): String { return StringDesc.Resource(resource).toString(this) } -fun Context.localize(resource: StringResource, vararg args: Any): String { +fun Context.stringResource(resource: StringResource, vararg args: Any): String { return StringDesc.ResourceFormatted(resource, *args).toString(this) } -fun Context.localizePlural(resource: PluralsResource, count: Int): String { +fun Context.pluralStringResource(resource: PluralsResource, count: Int): String { return StringDesc.Plural(resource, count).toString(this) } -fun Context.localizePlural(resource: PluralsResource, count: Int, vararg args: Any): String { +fun Context.pluralStringResource(resource: PluralsResource, count: Int, vararg args: Any): String { return StringDesc.PluralFormatted(resource, count, *args).toString(this) } diff --git a/core/src/main/java/tachiyomi/core/provider/AndroidBackupFolderProvider.kt b/core/src/main/java/tachiyomi/core/provider/AndroidBackupFolderProvider.kt index 7e7d223858..afed0d95c7 100644 --- a/core/src/main/java/tachiyomi/core/provider/AndroidBackupFolderProvider.kt +++ b/core/src/main/java/tachiyomi/core/provider/AndroidBackupFolderProvider.kt @@ -3,7 +3,7 @@ package tachiyomi.core.provider import android.content.Context import android.os.Environment import androidx.core.net.toUri -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.i18n.MR import java.io.File @@ -14,7 +14,7 @@ class AndroidBackupFolderProvider( override fun directory(): File { return File( Environment.getExternalStorageDirectory().absolutePath + File.separator + - context.localize(MR.strings.app_name), + context.stringResource(MR.strings.app_name), "backup", ) } diff --git a/core/src/main/java/tachiyomi/core/provider/AndroidDownloadFolderProvider.kt b/core/src/main/java/tachiyomi/core/provider/AndroidDownloadFolderProvider.kt index 899c826cf7..f42fcfbcf0 100644 --- a/core/src/main/java/tachiyomi/core/provider/AndroidDownloadFolderProvider.kt +++ b/core/src/main/java/tachiyomi/core/provider/AndroidDownloadFolderProvider.kt @@ -3,7 +3,7 @@ package tachiyomi.core.provider import android.content.Context import android.os.Environment import androidx.core.net.toUri -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.i18n.MR import java.io.File @@ -14,7 +14,7 @@ class AndroidDownloadFolderProvider( override fun directory(): File { return File( Environment.getExternalStorageDirectory().absolutePath + File.separator + - context.localize(MR.strings.app_name), + context.stringResource(MR.strings.app_name), "downloads", ) } diff --git a/i18n/src/commonMain/resources/MR/base/strings.xml b/i18n/src/commonMain/resources/MR/base/strings.xml index 3ff18662cb..ba1dbef48f 100644 --- a/i18n/src/commonMain/resources/MR/base/strings.xml +++ b/i18n/src/commonMain/resources/MR/base/strings.xml @@ -5,6 +5,10 @@ On Off + Selected + Not selected + More options + Navigate up Name @@ -39,9 +43,6 @@ Local Downloaded - Selected - Not selected - Unlock %s Authenticate to confirm change diff --git a/presentation-core/src/main/java/tachiyomi/presentation/core/components/SettingsItems.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/components/SettingsItems.kt index a4a17ba3ae..0094dbcd70 100644 --- a/presentation-core/src/main/java/tachiyomi/presentation/core/components/SettingsItems.kt +++ b/presentation-core/src/main/java/tachiyomi/presentation/core/components/SettingsItems.kt @@ -47,7 +47,7 @@ import tachiyomi.core.preference.Preference import tachiyomi.core.preference.TriState import tachiyomi.core.preference.toggle import tachiyomi.presentation.core.components.material.padding -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.theme.header import tachiyomi.presentation.core.util.collectAsState @@ -58,7 +58,7 @@ object SettingsItemsPaddings { @Composable fun HeadingItem(labelRes: StringResource) { - HeadingItem(localize(labelRes)) + HeadingItem(stringResource(labelRes)) } @Composable diff --git a/presentation-core/src/main/java/tachiyomi/presentation/core/i18n/Localize.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/i18n/Localize.kt index cb85f9aa35..081281f7f8 100644 --- a/presentation-core/src/main/java/tachiyomi/presentation/core/i18n/Localize.kt +++ b/presentation-core/src/main/java/tachiyomi/presentation/core/i18n/Localize.kt @@ -5,29 +5,29 @@ import androidx.compose.runtime.ReadOnlyComposable import androidx.compose.ui.platform.LocalContext import dev.icerock.moko.resources.PluralsResource import dev.icerock.moko.resources.StringResource -import tachiyomi.core.i18n.localize -import tachiyomi.core.i18n.localizePlural +import tachiyomi.core.i18n.pluralStringResource +import tachiyomi.core.i18n.stringResource @Composable @ReadOnlyComposable -fun localize(resource: StringResource): String { - return LocalContext.current.localize(resource) +fun stringResource(resource: StringResource): String { + return LocalContext.current.stringResource(resource) } @Composable @ReadOnlyComposable -fun localize(resource: StringResource, vararg args: Any): String { - return LocalContext.current.localize(resource, *args) +fun stringResource(resource: StringResource, vararg args: Any): String { + return LocalContext.current.stringResource(resource, *args) } @Composable @ReadOnlyComposable -fun localizePlural(resource: PluralsResource, count: Int): String { - return LocalContext.current.localizePlural(resource, count) +fun pluralStringResource(resource: PluralsResource, count: Int): String { + return LocalContext.current.pluralStringResource(resource, count) } @Composable @ReadOnlyComposable -fun localizePlural(resource: PluralsResource, count: Int, vararg args: Any): String { - return LocalContext.current.localizePlural(resource, count, *args) +fun pluralStringResource(resource: PluralsResource, count: Int, vararg args: Any): String { + return LocalContext.current.pluralStringResource(resource, count, *args) } diff --git a/presentation-core/src/main/java/tachiyomi/presentation/core/screens/EmptyScreen.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/screens/EmptyScreen.kt index b858f3f146..0922f925c8 100644 --- a/presentation-core/src/main/java/tachiyomi/presentation/core/screens/EmptyScreen.kt +++ b/presentation-core/src/main/java/tachiyomi/presentation/core/screens/EmptyScreen.kt @@ -25,7 +25,7 @@ import dev.icerock.moko.resources.StringResource import kotlinx.collections.immutable.ImmutableList import tachiyomi.presentation.core.components.ActionButton import tachiyomi.presentation.core.components.material.padding -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.util.secondaryItemAlpha import kotlin.random.Random @@ -42,7 +42,7 @@ fun EmptyScreen( actions: ImmutableList? = null, ) { EmptyScreen( - message = localize(stringRes), + message = stringResource(stringRes), modifier = modifier, actions = actions, ) @@ -89,7 +89,7 @@ fun EmptyScreen( actions.fastForEach { ActionButton( modifier = Modifier.weight(1f), - title = localize(it.stringRes), + title = stringResource(it.stringRes), icon = it.icon, onClick = it.onClick, ) diff --git a/presentation-widget/src/main/java/tachiyomi/presentation/widget/components/LockedWidget.kt b/presentation-widget/src/main/java/tachiyomi/presentation/widget/components/LockedWidget.kt index ce41fe7c60..20096ccbff 100644 --- a/presentation-widget/src/main/java/tachiyomi/presentation/widget/components/LockedWidget.kt +++ b/presentation-widget/src/main/java/tachiyomi/presentation/widget/components/LockedWidget.kt @@ -17,7 +17,7 @@ import androidx.glance.text.TextStyle import androidx.glance.unit.ColorProvider import tachiyomi.core.Constants import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource @Composable fun LockedWidget( @@ -34,7 +34,7 @@ fun LockedWidget( contentAlignment = Alignment.Center, ) { Text( - text = localize(MR.strings.appwidget_unavailable_locked), + text = stringResource(MR.strings.appwidget_unavailable_locked), style = TextStyle( color = foreground, fontSize = 12.sp, diff --git a/presentation-widget/src/main/java/tachiyomi/presentation/widget/components/UpdatesWidget.kt b/presentation-widget/src/main/java/tachiyomi/presentation/widget/components/UpdatesWidget.kt index 460d209f51..d31528170a 100644 --- a/presentation-widget/src/main/java/tachiyomi/presentation/widget/components/UpdatesWidget.kt +++ b/presentation-widget/src/main/java/tachiyomi/presentation/widget/components/UpdatesWidget.kt @@ -24,7 +24,7 @@ import androidx.glance.unit.ColorProvider import kotlinx.collections.immutable.ImmutableList import tachiyomi.core.Constants import tachiyomi.i18n.MR -import tachiyomi.presentation.core.i18n.localize +import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.widget.util.calculateRowAndColumnCount @Composable @@ -43,7 +43,7 @@ fun UpdatesWidget( CircularProgressIndicator(color = contentColor) } else if (data.isEmpty()) { Text( - text = localize(MR.strings.information_no_recent), + text = stringResource(MR.strings.information_no_recent), style = TextStyle(color = contentColor), ) } else { diff --git a/source-local/src/androidMain/kotlin/tachiyomi/source/local/LocalSource.kt b/source-local/src/androidMain/kotlin/tachiyomi/source/local/LocalSource.kt index 96e882d234..c3be92d2cb 100644 --- a/source-local/src/androidMain/kotlin/tachiyomi/source/local/LocalSource.kt +++ b/source-local/src/androidMain/kotlin/tachiyomi/source/local/LocalSource.kt @@ -16,7 +16,7 @@ import kotlinx.serialization.json.decodeFromStream import logcat.LogPriority import nl.adaptivity.xmlutil.AndroidXmlReader import nl.adaptivity.xmlutil.serialization.XML -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.core.metadata.comicinfo.COMIC_INFO_FILE import tachiyomi.core.metadata.comicinfo.ComicInfo import tachiyomi.core.metadata.comicinfo.copyFromComicInfo @@ -57,7 +57,7 @@ actual class LocalSource( private val POPULAR_FILTERS = FilterList(OrderBy.Popular(context)) private val LATEST_FILTERS = FilterList(OrderBy.Latest(context)) - override val name: String = context.localize(MR.strings.local_source) + override val name: String = context.stringResource(MR.strings.local_source) override val id: Long = ID @@ -312,9 +312,9 @@ actual class LocalSource( .map { dir -> File(dir, chapter.url) } .find { it.exists() } ?.let(Format.Companion::valueOf) - ?: throw Exception(context.localize(MR.strings.chapter_not_found)) + ?: throw Exception(context.stringResource(MR.strings.chapter_not_found)) } catch (e: Format.UnknownFormatException) { - throw Exception(context.localize(MR.strings.local_invalid_format)) + throw Exception(context.stringResource(MR.strings.local_invalid_format)) } catch (e: Exception) { throw e } diff --git a/source-local/src/androidMain/kotlin/tachiyomi/source/local/filter/OrderBy.kt b/source-local/src/androidMain/kotlin/tachiyomi/source/local/filter/OrderBy.kt index 58f039f879..9be063b9a3 100644 --- a/source-local/src/androidMain/kotlin/tachiyomi/source/local/filter/OrderBy.kt +++ b/source-local/src/androidMain/kotlin/tachiyomi/source/local/filter/OrderBy.kt @@ -2,12 +2,12 @@ package tachiyomi.source.local.filter import android.content.Context import eu.kanade.tachiyomi.source.model.Filter -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.i18n.MR sealed class OrderBy(context: Context, selection: Selection) : Filter.Sort( - context.localize(MR.strings.local_filter_order_by), - arrayOf(context.localize(MR.strings.title), context.localize(MR.strings.date)), + context.stringResource(MR.strings.local_filter_order_by), + arrayOf(context.stringResource(MR.strings.title), context.stringResource(MR.strings.date)), selection, ) { class Popular(context: Context) : OrderBy(context, Selection(0, true)) diff --git a/source-local/src/androidMain/kotlin/tachiyomi/source/local/io/LocalSourceFileSystem.kt b/source-local/src/androidMain/kotlin/tachiyomi/source/local/io/LocalSourceFileSystem.kt index 617ed5f3df..f645f8b755 100644 --- a/source-local/src/androidMain/kotlin/tachiyomi/source/local/io/LocalSourceFileSystem.kt +++ b/source-local/src/androidMain/kotlin/tachiyomi/source/local/io/LocalSourceFileSystem.kt @@ -2,7 +2,7 @@ package tachiyomi.source.local.io import android.content.Context import eu.kanade.tachiyomi.util.storage.DiskUtil -import tachiyomi.core.i18n.localize +import tachiyomi.core.i18n.stringResource import tachiyomi.i18n.MR import java.io.File @@ -10,7 +10,7 @@ actual class LocalSourceFileSystem( private val context: Context, ) { - private val baseFolderLocation = "${context.localize(MR.strings.app_name)}${File.separator}local" + private val baseFolderLocation = "${context.stringResource(MR.strings.app_name)}${File.separator}local" actual fun getBaseDirectories(): Sequence { return DiskUtil.getExternalStorages(context)