From 7299b63934f4cb60d665ea9cf2057178857d249b Mon Sep 17 00:00:00 2001 From: lleohao <12764126+lleohao@users.noreply.github.com> Date: Tue, 3 Sep 2024 02:39:50 +0000 Subject: [PATCH] feat: update space translation --- apps/client/public/locales/en/space.json | 4 +++- apps/client/public/locales/zh/space.json | 4 +++- apps/client/src/features/space/components/space-grid.tsx | 2 +- apps/client/src/features/space/components/space-list.tsx | 2 +- .../src/features/space/components/space-members.tsx | 2 +- apps/client/src/lib/utils.ts | 8 +++++--- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/apps/client/public/locales/en/space.json b/apps/client/public/locales/en/space.json index 8f98592c..3151a782 100644 --- a/apps/client/public/locales/en/space.json +++ b/apps/client/public/locales/en/space.json @@ -41,5 +41,7 @@ "Search for users and groups": "Search for users and groups", "No user found": "No user found", "Spaces you belong to": "Spaces you belong to", - "Recently updated": "Recently updated" + "Recently updated": "Recently updated", + "member": "member", + "members": "members" } diff --git a/apps/client/public/locales/zh/space.json b/apps/client/public/locales/zh/space.json index fe7f7744..06414cc9 100644 --- a/apps/client/public/locales/zh/space.json +++ b/apps/client/public/locales/zh/space.json @@ -41,5 +41,7 @@ "Search for users and groups": "搜索用户和群组", "No user found": "未找到用户", "Spaces you belong to": "您所属的空间", - "Recently updated": "最近更新" + "Recently updated": "最近更新", + "member": "个成员", + "members": "个成员" } diff --git a/apps/client/src/features/space/components/space-grid.tsx b/apps/client/src/features/space/components/space-grid.tsx index adae8c04..2b0f9a51 100644 --- a/apps/client/src/features/space/components/space-grid.tsx +++ b/apps/client/src/features/space/components/space-grid.tsx @@ -35,7 +35,7 @@ export default function SpaceGrid() { - {formatMemberCount(space.memberCount)} + {formatMemberCount(space.memberCount, t)} )); diff --git a/apps/client/src/features/space/components/space-list.tsx b/apps/client/src/features/space/components/space-list.tsx index 6105f074..a43de13f 100644 --- a/apps/client/src/features/space/components/space-list.tsx +++ b/apps/client/src/features/space/components/space-list.tsx @@ -53,7 +53,7 @@ export default function SpaceList() { - {formatMemberCount(space.memberCount)} + {formatMemberCount(space.memberCount, t)} ))} diff --git a/apps/client/src/features/space/components/space-members.tsx b/apps/client/src/features/space/components/space-members.tsx index fcfba14f..59d9f28f 100644 --- a/apps/client/src/features/space/components/space-members.tsx +++ b/apps/client/src/features/space/components/space-members.tsx @@ -127,7 +127,7 @@ export default function SpaceMembersList({ {member.type == "user" && member?.email} {member.type == "group" && - `Group - ${formatMemberCount(member?.memberCount)}`} + `Group - ${formatMemberCount(member?.memberCount, t)}`} diff --git a/apps/client/src/lib/utils.ts b/apps/client/src/lib/utils.ts index e9357014..b4c3cb64 100644 --- a/apps/client/src/lib/utils.ts +++ b/apps/client/src/lib/utils.ts @@ -1,8 +1,10 @@ -export function formatMemberCount(memberCount: number): string { +import { TFunction } from "i18next"; + +export function formatMemberCount(memberCount: number, t: TFunction): string { if (memberCount === 1) { - return "1 member"; + return `1 ${t('member')}`; } else { - return `${memberCount} members`; + return `${memberCount} ${t('members')}`; } }