Extract last strings to translations

This commit is contained in:
Shinokuni 2024-07-31 15:37:00 +02:00
parent 4771831d15
commit 4d8de57ade
13 changed files with 65 additions and 32 deletions

View File

@ -122,7 +122,7 @@ class AccountSelectionScreen : AndroidScreen() {
modifier = Modifier
.fillMaxSize()
.weight(1f)
.padding(MaterialTheme.spacing.mediumSpacing)
.padding(MaterialTheme.spacing.mediumSpacing)
) {
Image(
painter = adaptiveIconPainterResource(id = R.mipmap.ic_launcher),
@ -144,7 +144,8 @@ class AccountSelectionScreen : AndroidScreen() {
Text(
text = stringResource(id = R.string.choose_account),
style = MaterialTheme.typography.titleMedium,
modifier = Modifier.align(Alignment.CenterHorizontally)
modifier = Modifier
.align(Alignment.CenterHorizontally)
.padding(top = MaterialTheme.spacing.mediumSpacing)
)
@ -179,7 +180,7 @@ class AccountSelectionScreen : AndroidScreen() {
MediumSpacer()
Text(
text = "External",
text = stringResource(R.string.external),
style = MaterialTheme.typography.bodyMedium,
modifier = Modifier.padding(start = MaterialTheme.spacing.mediumSpacing)
)

View File

@ -249,7 +249,7 @@ object FeedTab : Tab {
is DialogState.DeleteFeed -> {
TwoChoicesDialog(
title = stringResource(R.string.delete_feed),
text = "Do you want to delete feed ${dialog.feed.name}?",
text = stringResource(R.string.delete_feed_question, dialog.feed.name!!),
icon = rememberVectorPainter(image = Icons.Default.Delete),
confirmText = stringResource(R.string.delete),
dismissText = stringResource(R.string.cancel),
@ -299,7 +299,7 @@ object FeedTab : Tab {
is DialogState.DeleteFolder -> {
TwoChoicesDialog(
title = stringResource(R.string.delete_folder),
text = "Do you want to delete folder ${dialog.folder.name}?",
text = stringResource(R.string.delete_folder_question, dialog.folder.name!!),
icon = rememberVectorPainter(image = Icons.Default.Delete),
confirmText = stringResource(R.string.delete),
dismissText = stringResource(R.string.cancel),

View File

@ -107,7 +107,7 @@ fun FeedModalBottomSheet(
)
BottomSheetOption(
text = "Update color",
text = stringResource(R.string.update_color),
icon = ImageVector.vectorResource(R.drawable.ic_color),
onClick = onUpdateColor
)

View File

@ -71,7 +71,7 @@ object HomeScreen : AndroidScreen() {
contentDescription = null
)
},
label = { Text("Timeline") }
label = { Text(stringResource(id = R.string.timeline)) }
)
NavigationBarItem(
@ -107,7 +107,7 @@ object HomeScreen : AndroidScreen() {
contentDescription = null,
)
},
label = { Text("More") }
label = { Text(stringResource(id = R.string.more)) }
)
}
},

View File

@ -42,6 +42,7 @@ import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
@ -351,8 +352,11 @@ fun SimpleTitle(
ShortSpacer()
val readTime =
if (item.readTime < 1) "< 1 min" else "${item.readTime.roundToInt()} mins"
val readTime = if (item.readTime > 1) {
stringResource(id = R.string.read_time, item.readTime.roundToInt())
} else {
stringResource(id = R.string.read_time_lower_than_1)
}
Text(
text = "${DateUtils.formattedDate(item.pubDate!!)} · $readTime",
style = MaterialTheme.typography.labelMedium,

View File

@ -43,7 +43,7 @@ object MoreTab : Tab, KoinComponent {
@Composable
get() = TabOptions(
index = 4u,
title = "More"
title = stringResource(R.string.more)
)

View File

@ -168,7 +168,7 @@ class PreferencesScreen : AndroidScreen() {
SwitchPreferenceWidget(
preference = loadedState.scrollReadPref.second,
isChecked = loadedState.scrollReadPref.first,
title = stringResource(id = R.string.mark_items_read)
title = stringResource(id = R.string.mark_items_read_on_scroll)
)
PreferenceHeader(text = stringResource(id = R.string.item_view))

View File

@ -75,7 +75,7 @@ fun FilterBottomSheet(
ShortSpacer()
Text(
text = "Show oldest items first"
text = stringResource(R.string.show_oldest_articles_first)
)
}

View File

@ -80,7 +80,7 @@ object TimelineTab : Tab {
@Composable
get() = TabOptions(
index = 1u,
title = "Timeline",
title = stringResource(id = R.string.timeline),
)
@SuppressLint("InlinedApi")
@ -192,11 +192,11 @@ object TimelineTab : Tab {
when (val dialog = state.dialog) {
is DialogState.ConfirmDialog -> {
TwoChoicesDialog(
title = "Mark all items as read",
text = "Do you really want to mark all items as read?",
title = stringResource(R.string.mark_all_articles_read),
text = stringResource(R.string.mark_all_articles_read_question),
icon = painterResource(id = R.drawable.ic_rss_feed_grey),
confirmText = "Validate",
dismissText = "Cancel",
confirmText = stringResource(id = R.string.validate),
dismissText = stringResource(id = R.string.cancel),
onDismiss = { screenModel.closeDialog() },
onConfirm = {
screenModel.closeDialog()

View File

@ -7,6 +7,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import com.readrops.app.R
import com.readrops.app.util.theme.ShortSpacer
@ -28,7 +29,7 @@ fun ErrorMessage(
ShortSpacer()
Text(
text = "An error occurred",
text = stringResource(R.string.error_occurred),
style = MaterialTheme.typography.headlineSmall,
color = MaterialTheme.colorScheme.error,
)

View File

@ -1,24 +1,25 @@
package com.readrops.app.util.components
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import com.readrops.app.R
sealed class TextFieldError {
object EmptyField : TextFieldError()
object BadUrl : TextFieldError()
object UnreachableUrl : TextFieldError()
object NoRSSFeed : TextFieldError()
object NoRSSUrl : TextFieldError()
data object EmptyField : TextFieldError()
data object BadUrl : TextFieldError()
data object UnreachableUrl : TextFieldError()
data object NoRSSFeed : TextFieldError()
data object NoRSSUrl : TextFieldError()
@Composable
fun errorText(): String =
// TODO replace by string resources
when (this) {
BadUrl -> "Input is not a valid URL"
EmptyField -> "Field can't be empty"
NoRSSFeed -> "No RSS feed found"
NoRSSUrl -> "The provided URL is not a valid RSS feed"
UnreachableUrl -> "Unreachable URL"
BadUrl -> stringResource(R.string.not_valid_url)
EmptyField -> stringResource(R.string.field_cant_be_empty)
NoRSSFeed -> stringResource(R.string.no_rss_feed_found)
NoRSSUrl -> stringResource(R.string.not_valid_rss_feed)
UnreachableUrl -> stringResource(R.string.unreachable_url)
}
}

View File

@ -140,7 +140,7 @@
<string name="app_description">App distribuée sous la licence GPLv3</string>
<string name="system">Thème du système</string>
<string name="hide_feeds">Cacher les flux sans nouveaux items</string>
<string name="mark_items_read">Marquer les items comme lus pendant le défilement</string>
<string name="mark_items_read_on_scroll">Marquer les items comme lus pendant le défilement</string>
<string name="filters">Filtres</string>
<plurals name="error_occurred">
<item quantity="one">Une erreur s\'est produite</item>
@ -195,4 +195,17 @@
<string name="show_notifications_background_sync">Afficher les notifications après la synchronisation en arrière-plan</string>
<string name="background_sync_new_articles">Soyez prévenus des nouveaux articles après la synchronisation en arrière-plan</string>
<string name="no_article">Aucun article</string>
<string name="not_valid_url">La saisie n\'est pas une URL valide</string>
<string name="field_cant_be_empty">Le champ ne peut pas être vide</string>
<string name="no_rss_feed_found">Aucun flux RSS trouvé</string>
<string name="not_valid_rss_feed">L\'URL fournie n\'est pas un flux RSS valide</string>
<string name="error_occurred">Une erreur est survenue</string>
<string name="more">Plus</string>
<string name="show_oldest_articles_first">Afficher les articles les plus anciens en premier</string>
<string name="delete_feed_question">Voulez-vous supprimer le flux %1$s ?</string>
<string name="delete_folder_question">Voulez-vous supprimer le dossier %1$s ? Tous les flux associés seront également supprimés.</string>
<string name="update_color">Modifier la couleur</string>
<string name="external">Externe</string>
<string name="mark_all_articles_read">Marquer les articles comme lus</string>
<string name="mark_all_articles_read_question">Voulez-vous vraiment marquer tous les articles comme lus ?</string>
</resources>

View File

@ -146,7 +146,7 @@
<string name="theme_value_dark" translatable="false">dark</string>
<string name="theme_value_system" translatable="false">system</string>
<string name="hide_feeds">Hide feeds without new items</string>
<string name="mark_items_read">Mark items read on scroll</string>
<string name="mark_items_read_on_scroll">Mark items read on scroll</string>
<string name="new_articles">New articles</string>
<string name="filters">Filters</string>
<plurals name="error_occurred">
@ -204,4 +204,17 @@
<string name="show_notifications_background_sync">Show notifications after background synchronization</string>
<string name="background_sync_new_articles">Be alerted of new articles after background synchronization</string>
<string name="no_article">No article</string>
<string name="not_valid_url">Input is not a valid URL</string>
<string name="field_cant_be_empty">Field can\'t be empty</string>
<string name="no_rss_feed_found">No RSS feed found</string>
<string name="not_valid_rss_feed">The provided URL is not a valid RSS feed</string>
<string name="error_occurred">An error occurred</string>
<string name="more">More</string>
<string name="show_oldest_articles_first">Show oldest articles first</string>
<string name="delete_feed_question">Do you want to delete feed %1$s?</string>
<string name="delete_folder_question">Do you want to delete folder %1$s? All linked feeds will also be deleted.</string>
<string name="update_color">Update color</string>
<string name="external">External</string>
<string name="mark_all_articles_read">Mark all articles as read</string>
<string name="mark_all_articles_read_question">Do you really want to mark all items as read?</string>
</resources>