Replace remaining Android-specific strings

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

View File

@@ -24,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),
)
}

View File

@@ -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,

View File

@@ -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,
)

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,
)

View File

@@ -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()

View File

@@ -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))
},
)
}

View File

@@ -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

View File

@@ -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,

View File

@@ -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,
)
}

View File

@@ -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))
},
)
}