Converted hardcoded pluralization strings to Android plural resources. (#176)
This commit is contained in:
parent
3f840a47c8
commit
2c03f125a9
5 changed files with 38 additions and 15 deletions
|
|
@ -1515,11 +1515,10 @@ private fun RemoveFromShelfConfirmationDialog(
|
|||
onConfirm: () -> Unit,
|
||||
onDismiss: () -> Unit
|
||||
) {
|
||||
val bookStr = pluralStringResource(id = R.plurals.book_word, count)
|
||||
AlertDialog(
|
||||
onDismissRequest = onDismiss,
|
||||
title = { Text(stringResource(R.string.dialog_remove_from_shelf)) },
|
||||
text = { Text(stringResource(R.string.dialog_remove_from_shelf_desc, count, bookStr, shelfName)) },
|
||||
text = { Text(pluralStringResource(R.plurals.dialog_remove_from_shelf_desc, count, count, shelfName)) },
|
||||
confirmButton = {
|
||||
TextButton(onClick = onConfirm) { Text(stringResource(R.string.action_remove)) }
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4330,7 +4330,7 @@ open class MainViewModel(application: Application) : AndroidViewModel(applicatio
|
|||
_internalState.update {
|
||||
it.copy(
|
||||
isLoading = false,
|
||||
bannerMessage = BannerMessage(appContext.getString(R.string.banner_books_removed_library, totalRemoved))
|
||||
bannerMessage = BannerMessage(appContext.resources.getQuantityString(R.plurals.banner_books_removed_library, totalRemoved, totalRemoved))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ import androidx.compose.ui.platform.LocalContext
|
|||
import androidx.compose.ui.platform.LocalUriHandler
|
||||
import androidx.compose.ui.platform.UriHandler
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.pluralStringResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.AnnotatedString
|
||||
import androidx.compose.ui.text.SpanStyle
|
||||
|
|
@ -295,16 +296,16 @@ fun DeleteConfirmationDialog(
|
|||
isPermanentDelete: Boolean = false,
|
||||
containsFolderItems: Boolean = false
|
||||
) {
|
||||
val title = if (isPermanentDelete) stringResource(R.string.dialog_delete_permanently) else stringResource(R.string.dialog_remove_from_recents)
|
||||
val title = if (isPermanentDelete) pluralStringResource(R.plurals.dialog_delete_permanently, count) else stringResource(R.string.dialog_remove_from_recents)
|
||||
|
||||
val text = if (isPermanentDelete) {
|
||||
if (containsFolderItems) {
|
||||
stringResource(R.string.dialog_warning_folder_sync_delete)
|
||||
} else {
|
||||
stringResource(R.string.dialog_permanently_delete_desc, count)
|
||||
pluralStringResource(R.plurals.dialog_permanently_delete_desc, count, count)
|
||||
}
|
||||
} else {
|
||||
stringResource(R.string.dialog_remove_recents_desc, count)
|
||||
pluralStringResource(R.plurals.dialog_remove_recents_desc, count, count)
|
||||
}
|
||||
|
||||
val confirmText = if (isPermanentDelete) stringResource(R.string.action_delete) else stringResource(R.string.action_remove)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue