Skip to content

Commit

Permalink
chore: add translations
Browse files Browse the repository at this point in the history
  • Loading branch information
juliajforesti committed Oct 6, 2023
1 parent cf537a1 commit c5d35d5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof useTranslation>,
) => {
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(', ');
};
Expand Down Expand Up @@ -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 = (
<Margins inlineStart={8}>
Expand Down
10 changes: 9 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit c5d35d5

Please sign in to comment.