Added more plural strings

This commit is contained in:
Jay 2020-01-20 14:37:07 -08:00
parent 5587080c95
commit 81eaf8bb95
4 changed files with 27 additions and 12 deletions

View file

@ -492,7 +492,8 @@ class LibraryUpdateService(
color = ContextCompat.getColor(this@LibraryUpdateService, R.color.colorAccentLight)
val chaptersNames = if (chapterNames.size > 5) {
"${chapterNames.take(4).joinToString(", ")}, " +
getString(R.string.notification_and_n_more, (chapterNames.size - 4))
resources.getQuantityString(R.plurals.notification_and_n_more,
(chapterNames.size - 4), (chapterNames.size - 4))
} else chapterNames.joinToString(", ")
setContentText(chaptersNames)
setStyle(NotificationCompat.BigTextStyle().bigText(chaptersNames))

View file

@ -42,8 +42,10 @@ class ExtensionUpdateJob : Job() {
)
)
val extNames = if (names.size > 5) {
"${names.take(4).joinToString(", ")}, " + context.getString(
R.string.notification_and_n_more, (names.size - 4)
"${names.take(4).joinToString(", ")}, " +
context.resources.getQuantityString(
R.plurals.notification_and_n_more_ext,
(names.size - 4), (names.size - 4)
)
} else names.joinToString(", ")
setContentText(extNames)

View file

@ -22,10 +22,10 @@ class MigrationMangaDialog<T>(bundle: Bundle? = null) : DialogController(bundle)
}
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
val confirmRes = if (copy) R.string.confirm_copy else R.string.confirm_migration
val confirmString = applicationContext?.getString(confirmRes, mangaSet, (
if (mangaSkipped > 0)
" " + applicationContext?.getString(R.string.skipping_x, mangaSkipped) ?: ""
val confirmRes = if (copy) R.plurals.confirm_copy else R.plurals.confirm_migration
val confirmString = applicationContext?.resources?.getQuantityString(confirmRes, mangaSet,
mangaSet, (
if (mangaSkipped > 0) " " + applicationContext?.getString(R.string.skipping_x, mangaSkipped)
else "")) ?: ""
return MaterialDialog(activity!!).show {
message(text = confirmString)

View file

@ -474,8 +474,14 @@
<string name="download_all">All</string>
<string name="download_unread">Unread</string>
<string name="confirm_delete_chapters">Are you sure you want to delete selected chapters?</string>
<string name="confirm_migration">Migrate %1$d%2$s manga?</string>
<string name="confirm_copy">Copy %1$d%2$s manga?</string>
<plurals name="confirm_migration">
<item quantity="one">Migrate %1$d%2$s manga?</item>
<item quantity="other">Migrate %1$d%2$s manga?</item>
</plurals>
<plurals name="confirm_copy">
<item quantity="one">Copy %1$d%2$s manga?</item>
<item quantity="other">Copy %1$d%2$s manga?</item>
</plurals>
<string name="skipping_x">(skipping %1$d)</string>
<plurals name="manga_migrated">
<item quantity="one">%d manga migrated</item>
@ -570,11 +576,17 @@
<string name="notification_update_progress">Update progress: %1$d/%2$d</string>
<string name="notification_new_chapters">New chapters found</string>
<plurals name="notification_new_chapters_text">
<item quantity="one">For %d titles</item>
<item quantity="one">For %d title</item>
<item quantity="other">For %d titles</item>
</plurals>
<string name="notification_and_n_more">and %1$d more chapters.</string>
<string name="notification_and_n_more_ext">and %1$d more extensions.</string>
<plurals name="notification_and_n_more">
<item quantity="one">and %1$d more chapter.</item>
<item quantity="other">and %1$d more chapters.</item>
</plurals>
<plurals name="notification_and_n_more_ext">
<item quantity="one">and %1$d more extension.</item>
<item quantity="other">and %1$d more extensions.</item>
</plurals>
<string name="notification_cover_update_failed">Failed to update cover</string>
<string name="notification_first_add_to_library">Please add the manga to your library before doing this</string>
<string name="notification_not_connected_to_ac_title">Sync canceled</string>