pluralize x_unread_conversations string

This commit is contained in:
Daniel Gultsch 2021-01-23 11:25:22 +01:00
parent 6a89a472e1
commit 9c9a953281
2 changed files with 9 additions and 4 deletions

View File

@ -663,7 +663,7 @@ public class NotificationService {
private Builder buildMultipleConversation(final boolean notify, final boolean quietHours) { private Builder buildMultipleConversation(final boolean notify, final boolean quietHours) {
final Builder mBuilder = new NotificationCompat.Builder(mXmppConnectionService, quietHours ? "quiet_hours" : (notify ? "messages" : "silent_messages")); final Builder mBuilder = new NotificationCompat.Builder(mXmppConnectionService, quietHours ? "quiet_hours" : (notify ? "messages" : "silent_messages"));
final NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle(); 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(); final StringBuilder names = new StringBuilder();
Conversation conversation = null; Conversation conversation = null;
for (final ArrayList<Message> messages : notifications.values()) { for (final ArrayList<Message> messages : notifications.values()) {
@ -688,8 +688,9 @@ public class NotificationService {
if (names.length() >= 2) { if (names.length() >= 2) {
names.delete(names.length() - 2, names.length()); names.delete(names.length() - 2, names.length());
} }
mBuilder.setContentTitle(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.setTicker(mXmppConnectionService.getString(R.string.x_unread_conversations, notifications.size())); mBuilder.setContentTitle(contentTitle);
mBuilder.setTicker(contentTitle);
mBuilder.setContentText(names.toString()); mBuilder.setContentText(names.toString());
mBuilder.setStyle(style); mBuilder.setStyle(style);
if (conversation != null) { if (conversation != null) {

View File

@ -29,7 +29,11 @@
<string name="just_now">just now</string> <string name="just_now">just now</string>
<string name="minute_ago">1 min ago</string> <string name="minute_ago">1 min ago</string>
<string name="minutes_ago">%d mins ago</string> <string name="minutes_ago">%d mins ago</string>
<string name="x_unread_conversations">%d unread conversations</string> <plurals name="x_unread_conversations">
<item quantity="one">%d unread conversation</item>
<item quantity="other">%d unread conversations</item>
</plurals>
<string name="sending">sending…</string> <string name="sending">sending…</string>
<string name="message_decrypting">Decrypting message. Please wait…</string> <string name="message_decrypting">Decrypting message. Please wait…</string>
<string name="pgp_message">OpenPGP encrypted message</string> <string name="pgp_message">OpenPGP encrypted message</string>