diff --git a/apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx b/apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx index 60d711f0c544..f275ff2800d8 100644 --- a/apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx +++ b/apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx @@ -33,19 +33,26 @@ const getMessage = (room: IRoom, lastMessage: IMessage | undefined, t: ReturnTyp return `${lastMessage.u.name || lastMessage.u.username}: ${normalizeSidebarMessage(lastMessage, t)}`; }; -const getBadgeTitle = (userMentions: number, threadUnread: number, groupMentions: number, unread: number) => { +const getBadgeTitle = ( + userMentions: number, + threadUnread: number, + groupMentions: number, + unread: number, + t: ReturnType, +) => { const title = [] as string[]; if (userMentions) { - [...title, `${userMentions} mention(s)`]; + title.push(t('mentions_counter', { count: userMentions })); } if (threadUnread) { - [...title, `${threadUnread} unread threaded message(s)`]; + title.push(t('threads_counter', { count: threadUnread })); } if (groupMentions) { - [...title, `${groupMentions} group mention(s)`]; + title.push(t('group_mentions_counter', { count: groupMentions })); } - if (!userMentions && !threadUnread && !groupMentions && unread) { - [...title, `${unread} unread message(s)`]; + const count = unread - userMentions - groupMentions; + if (count > 0) { + title.push(t('unread_messages_counter', { count })); } return title.join(', '); }; @@ -154,7 +161,7 @@ function SideBarItemTemplateWithData({ const isUnread = unread > 0 || threadUnread; const showBadge = !hideUnreadStatus || (!hideMentionStatus && (Boolean(userMentions) || tunreadUser.length > 0)); - const badgeTitle = getBadgeTitle(userMentions, tunread.length, groupMentions, unread); + const badgeTitle = getBadgeTitle(userMentions, tunread.length, groupMentions, unread, t); const badges = ( diff --git a/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json b/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json index e713f095f490..ddb5871000b2 100644 --- a/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json @@ -6070,5 +6070,13 @@ "All_visible": "All visible", "Filter_by_room": "Filter by room type", "Filter_by_visibility": "Filter by visibility", - "Theme_Appearence": "Theme Appearence" + "Theme_Appearence": "Theme Appearence", + "mentions_counter": "{{count}} mention", + "mentions_counter_plural": "{{count}} mentions", + "threads_counter": "{{count}} unread threaded message", + "threads_counter_plural": "{{count}} unread threaded messages", + "group_mentions_counter": "{{count}} group mention", + "group_mentions_counter_plural": "{{count}} group mentions", + "unread_messages_counter": "{{count}} unread message", + "unread_messages_counter_plural": "{{count}} unread messages" }