Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
message_notifications: Tag notification text for translation.
Aman Agrawalcd2812c13164
diff --git a/web/src/message_notifications.js b/web/src/message_notifications.jsindex cae75941c58..2e471ee460f 100644--- a/web/src/message_notifications.js+++ b/web/src/message_notifications.js@@ -13,6 +13,7 @@ import * as ui_util from "./ui_util";import * as unread from "./unread";import {user_settings} from "./user_settings";import * as user_topics from "./user_topics";+import * as util from "./util";function get_notification_content(message) {let content;@@ -89,29 +90,46 @@ function get_notification_title(message, msg_count) {let title_prefix = message.sender_full_name;let title_suffix = "";let other_recipients;+ let other_recipients_translated;if (msg_count > 1) {- title_prefix = msg_count + " messages from " + message.sender_full_name;+ title_prefix = $t(+ {defaultMessage: "{msg_count} messages from {sender_name}"},+ {msg_count, sender_name: message.sender_full_name},+ );}switch (message.type) {case "private":- other_recipients = remove_sender_from_list_of_recipients(message);if (message.display_recipient.length > 2) {+ other_recipients = remove_sender_from_list_of_recipients(message);+ // Same as compose_ui.compute_placeholder_text.+ other_recipients_translated = util.format_array_as_list(+ other_recipients.split(", "),+ "long",+ "conjunction",+ );// Character limit taken from https://www.pushengage.com/push-notification-character-limits// We use a higher character limit so that the 3rd sender can at least be partially visible so that// the user can distinguish the group DM.// If the message has too many recipients to list them all...- if (title_prefix.length + other_recipients.length > 50) {+ if (title_prefix.length + other_recipients_translated.length > 50) {// Then count how many people are in the conversation and summarize- other_recipients = message.display_recipient.length - 2 + " more";+ title_suffix = $t(+ {defaultMessage: "(to you and {participants_count} more)"},+ {participants_count: message.display_recipient.length - 2},+ );+ } else {+ title_suffix = $t(+ {defaultMessage: "(to you and {other_participant_names})"},+ {other_participant_names: other_recipients_translated},+ );}-- title_suffix = " (to you and " + other_recipients + ")";} else {- title_suffix = " (to you)";+ title_suffix = $t({defaultMessage: "(to you)"});}- break;++ return title_prefix + " " + title_suffix;case "stream": {const stream_name = stream_data.get_stream_name_from_id(message.stream_id);title_suffix = " (#" + stream_name + " > " + message.topic + ")";