From 9c9a9532817e2b62842b6b1dbc55db135046c14e Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 23 Jan 2021 11:25:22 +0100 Subject: [PATCH] pluralize x_unread_conversations string --- .../siacs/conversations/services/NotificationService.java | 7 ++++--- src/main/res/values/strings.xml | 6 +++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index bc7d5d97f..bb1c81d94 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -663,7 +663,7 @@ public class NotificationService { private Builder buildMultipleConversation(final boolean notify, final boolean quietHours) { final Builder mBuilder = new NotificationCompat.Builder(mXmppConnectionService, quietHours ? "quiet_hours" : (notify ? "messages" : "silent_messages")); final NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle(); - style.setBigContentTitle(mXmppConnectionService.getString(R.string.x_unread_conversations, notifications.size())); + style.setBigContentTitle(mXmppConnectionService.getResources().getQuantityString(R.plurals.x_unread_conversations, notifications.size(), notifications.size())); final StringBuilder names = new StringBuilder(); Conversation conversation = null; for (final ArrayList messages : notifications.values()) { @@ -688,8 +688,9 @@ public class NotificationService { if (names.length() >= 2) { names.delete(names.length() - 2, names.length()); } - mBuilder.setContentTitle(mXmppConnectionService.getString(R.string.x_unread_conversations, notifications.size())); - mBuilder.setTicker(mXmppConnectionService.getString(R.string.x_unread_conversations, notifications.size())); + final String contentTitle = mXmppConnectionService.getResources().getQuantityString(R.plurals.x_unread_conversations, notifications.size(), notifications.size()); + mBuilder.setContentTitle(contentTitle); + mBuilder.setTicker(contentTitle); mBuilder.setContentText(names.toString()); mBuilder.setStyle(style); if (conversation != null) { diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 5aba03dfd..c0648925d 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -29,7 +29,11 @@ just now 1 min ago %d mins ago - %d unread conversations + + %d unread conversation + %d unread conversations + + sending… Decrypting message. Please wait… OpenPGP encrypted message