Fixed plural strings text

This commit is contained in:
Jay 2020-01-12 13:17:06 -08:00
parent b1ae3629fd
commit cbd2118b3e
6 changed files with 17 additions and 9 deletions

View File

@ -380,7 +380,8 @@ class BackupRestoreService : Service() {
.toString(), errors.size.toString())) .toString(), errors.size.toString()))
val sourceMissingCount = sourcesMissing.distinct().size val sourceMissingCount = sourcesMissing.distinct().size
if (sourceMissingCount > 0) if (sourceMissingCount > 0)
content.add(resources.getQuantityString(R.plurals.sources_missing, sourceMissingCount)) content.add(resources.getQuantityString(R.plurals.sources_missing,
sourceMissingCount, sourceMissingCount))
if (lincensedManga > 0) if (lincensedManga > 0)
content.add(getString(R.string.x_licensed_manga, lincensedManga)) content.add(getString(R.string.x_licensed_manga, lincensedManga))
val trackingErrors = trackingErrors.distinct() val trackingErrors = trackingErrors.distinct()

View File

@ -533,8 +533,9 @@ class LibraryUpdateService(
setContentTitle(getString(R.string.notification_new_chapters)) setContentTitle(getString(R.string.notification_new_chapters))
color = ContextCompat.getColor(applicationContext, R.color.colorAccentLight) color = ContextCompat.getColor(applicationContext, R.color.colorAccentLight)
if (updates.size > 1) { if (updates.size > 1) {
setContentText(resources.getQuantityText(R.plurals.notification_new_chapters_text, setContentText(resources.getQuantityString(R.plurals
updates.size)) .notification_new_chapters_text,
updates.size, updates.size))
setStyle(NotificationCompat.BigTextStyle().bigText(updates.joinToString("\n") { setStyle(NotificationCompat.BigTextStyle().bigText(updates.joinToString("\n") {
it.first.title.chop(45) it.first.title.chop(45)
})) }))

View File

@ -33,8 +33,9 @@ class ExtensionUpdateJob : Job() {
notify(Notifications.ID_UPDATES_TO_EXTS, notify(Notifications.ID_UPDATES_TO_EXTS,
context.notification(Notifications.CHANNEL_UPDATES_TO_EXTS) { context.notification(Notifications.CHANNEL_UPDATES_TO_EXTS) {
setContentTitle( setContentTitle(
context.resources.getQuantityText( context.resources.getQuantityString(
R.plurals.update_check_notification_ext_updates, names.size R.plurals.update_check_notification_ext_updates, names
.size, names.size
) )
) )
val extNames = if (names.size > 5) { val extNames = if (names.size > 5) {

View File

@ -96,7 +96,8 @@ class SettingsAdvancedController : SettingsController() {
}, { }, {
activity?.toast(R.string.cache_delete_error) activity?.toast(R.string.cache_delete_error)
}, { }, {
activity?.toast(resources?.getQuantityString(R.plurals.cache_deleted, deletedFiles)) activity?.toast(resources?.getQuantityString(R.plurals.cache_deleted,
deletedFiles, deletedFiles))
findPreference(CLEAR_CACHE_KEY)?.summary = findPreference(CLEAR_CACHE_KEY)?.summary =
resources?.getString(R.string.used_cache, chapterCache.readableSize) resources?.getString(R.string.used_cache, chapterCache.readableSize)
}) })

View File

@ -121,7 +121,8 @@ class SettingsGeneralController : SettingsController() {
when (it) { when (it) {
"0" -> context.getString(R.string.lock_always) "0" -> context.getString(R.string.lock_always)
"-1" -> context.getString(R.string.lock_never) "-1" -> context.getString(R.string.lock_never)
else -> context.getString(R.string.lock_after_mins, it) else -> resources?.getQuantityString(R.plurals.lock_after_mins, it.toInt(),
it)
} }
}.toTypedArray() }.toTypedArray()
entryValues = values entryValues = values

View File

@ -188,7 +188,10 @@
<string name="lock_when_idle">Lock when idle</string> <string name="lock_when_idle">Lock when idle</string>
<string name="lock_always">Always</string> <string name="lock_always">Always</string>
<string name="lock_never">Never</string> <string name="lock_never">Never</string>
<string name="lock_after_mins">After %1$s minutes</string> <plurals name="lock_after_mins">
<item quantity="one">After %1$s minutes</item>
<item quantity="other">After %1$s minutes</item>
</plurals>
<string name="search_hint">Search title, tags, source</string> <string name="search_hint">Search title, tags, source</string>
<string name="pref_refresh_covers_too">Automatically refresh covers</string> <string name="pref_refresh_covers_too">Automatically refresh covers</string>
<string name="pref_refresh_covers_too_summary">Refresh covers in library as well <string name="pref_refresh_covers_too_summary">Refresh covers in library as well
@ -578,7 +581,7 @@
<string name="update_check_notification_download_error">Download error</string> <string name="update_check_notification_download_error">Download error</string>
<string name="update_check_notification_update_available">Update available</string> <string name="update_check_notification_update_available">Update available</string>
<plurals name="update_check_notification_ext_updates"> <plurals name="update_check_notification_ext_updates">
<item quantity="one">%d extension update available</item> <item quantity="one">Extension update available</item>
<item quantity="other">%d extension updates available</item> <item quantity="other">%d extension updates available</item>
</plurals> </plurals>