Replace remaining Android-specific strings

Also renaming the helper composables so it's a bit easier to find/replace everything
in forks.
This commit is contained in:
arkon
2023-11-18 19:41:33 -05:00
parent 46e734fc8e
commit 0d1bced122
165 changed files with 1179 additions and 1167 deletions
@@ -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) },
)
@@ -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)
}
@@ -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,
@@ -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,
@@ -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)
}
@@ -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<DownloadCache>().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<ResetViewerFlags>().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
@@ -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()
}
@@ -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<SourcePreferences>() }
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)),
),
),
)
@@ -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)) {
@@ -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<String, String> {
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<Category>,
): 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)),
),
)
}
@@ -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),
),
),
),
@@ -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,
@@ -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),
),
),
)
@@ -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(),
)
@@ -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)),
)
}
}
@@ -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))
}
}
},
@@ -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",
)
@@ -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) },
),
@@ -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,
)
@@ -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,
@@ -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,
)
}
@@ -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)
@@ -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)
@@ -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,
)
}
@@ -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))
}
},
)
@@ -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))
}
}
}
@@ -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 <T> ListPreferenceWidget(
},
confirmButton = {
TextButton(onClick = { isDialogShown = false }) {
Text(text = localize(MR.strings.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
)
@@ -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))
}
},
)
@@ -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),
)
}
}
@@ -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 <T> 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 <T> 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 <T> TriStateListDialog(
onValueChanged(included, excluded)
},
) {
Text(text = localize(MR.strings.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
)
@@ -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),
)
}
}
@@ -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(