diff --git a/apps/client/public/locales/en/group.json b/apps/client/public/locales/en/group.json index 9e26dfee..5f7ce567 100644 --- a/apps/client/public/locales/en/group.json +++ b/apps/client/public/locales/en/group.json @@ -1 +1,34 @@ -{} \ No newline at end of file +{ + "Groups": "Groups", + "Create group": "Create group", + "Group": "Group", + "Members": "Members", + "member": "member", + "members": "members", + "Manage Group": "Manage Group", + "addGroupMembers": "addGroupMembers", + "add": "add", + "Edit group": "Edit group", + "Group name": "Group name", + "e.g Developers": "e.g Developers", + "Group description": "Group description", + "e.g Group for developers": "e.g Group for developers", + "Edit": "Edit", + "Delete group": "Delete group", + "Are you sure you want to delete this group? Members will lose access to resources this group has access to.": "Are you sure you want to delete this group? Members will lose access to resources this group has access to.", + "Delete": "Delete", + "Cancel": "Cancel", + "Remove group member": "Remove group member", + "Are you sure you want to remove this user from the group? The user will lose access to resources this group has access to.": "Are you sure you want to remove this user from the group? The user will lose access to resources this group has access to.", + "Add group members": "Add group members", + "Create": "Create", + "User": "User", + "Status": "Status", + "Active": "Active", + "Add members": "Add members", + "Search for users": "Search for users", + "No user found": "No user found", + "Add groups": "Add groups", + "Search for groups": "Search for groups", + "No group found": "No group found" +} diff --git a/apps/client/public/locales/en/settings.json b/apps/client/public/locales/en/settings.json index 1835d809..5515654d 100644 --- a/apps/client/public/locales/en/settings.json +++ b/apps/client/public/locales/en/settings.json @@ -48,40 +48,7 @@ "Failed to update data": "Failed to update data" }, "member": {}, - "group": { - "Groups": "Groups", - "Create group": "Create group", - "Group": "Group", - "Members": "Members", - "member": "member", - "members": "members", - "Manage Group": "Manage Group", - "addGroupMembers": "addGroupMembers", - "add": "add", - "Edit group": "Edit group", - "Group name": "Group name", - "e.g Developers": "e.g Developers", - "Group description": "Group description", - "e.g Group for developers": "e.g Group for developers", - "Edit": "Edit", - "Delete group": "Delete group", - "Are you sure you want to delete this group? Members will lose access to resources this group has access to.": "Are you sure you want to delete this group? Members will lose access to resources this group has access to.", - "Delete": "Delete", - "Cancel": "Cancel", - "Remove group member": "Remove group member", - "Are you sure you want to remove this user from the group? The user will lose access to resources this group has access to.": "Are you sure you want to remove this user from the group? The user will lose access to resources this group has access to.", - "Add group members": "Add group members", - "Create": "Create", - "User": "User", - "Status": "Status", - "Active": "Active", - "Add members": "Add members", - "Search for users": "Search for users", - "No user found": "No user found", - "Add groups": "Add groups", - "Search for groups": "Search for groups", - "No group found": "No group found" - }, + "group": {}, "space": {} } } diff --git a/apps/client/public/locales/zh/group.json b/apps/client/public/locales/zh/group.json index 9e26dfee..456c9e03 100644 --- a/apps/client/public/locales/zh/group.json +++ b/apps/client/public/locales/zh/group.json @@ -1 +1,34 @@ -{} \ No newline at end of file +{ + "Groups": "群组", + "Create group": "创建群组", + "Group": "群组", + "Members": "成员", + "member": "个成员", + "members": "个成员", + "Manage Group": "管理群组", + "addGroupMembers": "添加群组成员", + "add": "添加", + "Edit group": "编辑群组", + "Group name": "群组名称", + "e.g Developers": "例如:开发人员", + "Group description": "群组描述", + "e.g Group for developers": "例如:开发人员群组", + "Edit": "编辑", + "Delete group": "删除群组", + "Are you sure you want to delete this group? Members will lose access to resources this group has access to.": "您确定要删除这个群组吗?成员将失去对该群组可访问资源的访问权限。", + "Delete": "删除", + "Cancel": "取消", + "Remove group member": "移除群组成员", + "Are you sure you want to remove this user from the group? The user will lose access to resources this group has access to.": "您确定要从群组中移除这个用户吗?该用户将失去对该群组可访问资源的访问权限。", + "Add group members": "添加群组成员", + "Create": "创建", + "User": "用户", + "Status": "状态", + "Active": "活跃", + "Add members": "添加成员", + "Search for users": "搜索用户", + "No user found": "未找到用户", + "Add groups": "添加群组", + "Search for groups": "搜索群组", + "No group found": "未找到群组" +} diff --git a/apps/client/public/locales/zh/settings.json b/apps/client/public/locales/zh/settings.json index c4062767..09e8f254 100644 --- a/apps/client/public/locales/zh/settings.json +++ b/apps/client/public/locales/zh/settings.json @@ -48,40 +48,7 @@ "Failed to update data": "数据更新失败" }, "member": {}, - "group": { - "Groups": "群组", - "Create group": "创建群组", - "Group": "群组", - "Members": "成员", - "member": "成员", - "members": "成员", - "Manage Group": "管理群组", - "addGroupMembers": "添加群组成员", - "add": "添加", - "Edit group": "编辑群组", - "Group name": "群组名称", - "e.g Developers": "例如:开发人员", - "Group description": "群组描述", - "e.g Group for developers": "例如:开发人员群组", - "Edit": "编辑", - "Delete group": "删除群组", - "Are you sure you want to delete this group? Members will lose access to resources this group has access to.": "您确定要删除这个群组吗?成员将失去对该群组可访问资源的访问权限。", - "Delete": "删除", - "Cancel": "取消", - "Remove group member": "移除群组成员", - "Are you sure you want to remove this user from the group? The user will lose access to resources this group has access to.": "您确定要从群组中移除这个用户吗?该用户将失去对该群组可访问资源的访问权限。", - "Add group members": "添加群组成员", - "Create": "创建", - "User": "用户", - "Status": "状态", - "Active": "活跃", - "Add members": "添加成员", - "Search for users": "搜索用户", - "No user found": "未找到用户", - "Add groups": "添加群组", - "Search for groups": "搜索群组", - "No group found": "未找到群组" - }, + "group": {}, "space": {} } } diff --git a/apps/client/src/features/group/components/add-group-member-modal.tsx b/apps/client/src/features/group/components/add-group-member-modal.tsx index f7389168..d90d0b6d 100644 --- a/apps/client/src/features/group/components/add-group-member-modal.tsx +++ b/apps/client/src/features/group/components/add-group-member-modal.tsx @@ -7,9 +7,7 @@ import { useAddGroupMemberMutation } from "@/features/group/queries/group-query. import { useTranslation } from "react-i18next"; export default function AddGroupMemberModal() { - const { t } = useTranslation("settings", { - keyPrefix: "workspace.group", - }); + const { t } = useTranslation("group"); const { groupId } = useParams(); const [opened, { open, close }] = useDisclosure(false); const [userIds, setUserIds] = useState([]); diff --git a/apps/client/src/features/group/components/create-group-form.tsx b/apps/client/src/features/group/components/create-group-form.tsx index ad702017..8685ef0f 100644 --- a/apps/client/src/features/group/components/create-group-form.tsx +++ b/apps/client/src/features/group/components/create-group-form.tsx @@ -15,9 +15,7 @@ const formSchema = z.object({ type FormValues = z.infer; export function CreateGroupForm() { - const { t } = useTranslation("settings", { - keyPrefix: "workspace.group", - }); + const { t } = useTranslation("group"); const createGroupMutation = useCreateGroupMutation(); const [userIds, setUserIds] = useState([]); const navigate = useNavigate(); diff --git a/apps/client/src/features/group/components/create-group-modal.tsx b/apps/client/src/features/group/components/create-group-modal.tsx index e1aaaa34..17f67ee8 100644 --- a/apps/client/src/features/group/components/create-group-modal.tsx +++ b/apps/client/src/features/group/components/create-group-modal.tsx @@ -4,9 +4,7 @@ import { CreateGroupForm } from "@/features/group/components/create-group-form.t import { useTranslation } from "react-i18next"; export default function CreateGroupModal() { - const { t } = useTranslation("settings", { - keyPrefix: "workspace.group", - }); + const { t } = useTranslation("group"); const [opened, { open, close }] = useDisclosure(false); return ( diff --git a/apps/client/src/features/group/components/edit-group-form.tsx b/apps/client/src/features/group/components/edit-group-form.tsx index ec1b948b..61615603 100644 --- a/apps/client/src/features/group/components/edit-group-form.tsx +++ b/apps/client/src/features/group/components/edit-group-form.tsx @@ -19,9 +19,7 @@ interface EditGroupFormProps { onClose?: () => void; } export function EditGroupForm({ onClose }: EditGroupFormProps) { - const { t } = useTranslation("settings", { - keyPrefix: "workspace.group", - }); + const { t } = useTranslation("group"); const updateGroupMutation = useUpdateGroupMutation(); const { isSuccess } = updateGroupMutation; const { groupId } = useParams(); diff --git a/apps/client/src/features/group/components/edit-group-modal.tsx b/apps/client/src/features/group/components/edit-group-modal.tsx index a0d2e608..80225f66 100644 --- a/apps/client/src/features/group/components/edit-group-modal.tsx +++ b/apps/client/src/features/group/components/edit-group-modal.tsx @@ -11,9 +11,7 @@ export default function EditGroupModal({ opened, onClose, }: EditGroupModalProps) { - const { t } = useTranslation("settings", { - keyPrefix: "workspace.group", - }); + const { t } = useTranslation("group"); return ( <> diff --git a/apps/client/src/features/group/components/group-action-menu.tsx b/apps/client/src/features/group/components/group-action-menu.tsx index 6329333f..bd0e4817 100644 --- a/apps/client/src/features/group/components/group-action-menu.tsx +++ b/apps/client/src/features/group/components/group-action-menu.tsx @@ -12,9 +12,7 @@ import { modals } from "@mantine/modals"; import { useTranslation } from "react-i18next"; export default function GroupActionMenu() { - const { t } = useTranslation("settings", { - keyPrefix: "workspace.group", - }); + const { t } = useTranslation("group"); const { groupId } = useParams(); const { data: group, isLoading } = useGroupQuery(groupId); const deleteGroupMutation = useDeleteGroupMutation(); diff --git a/apps/client/src/features/group/components/group-list.tsx b/apps/client/src/features/group/components/group-list.tsx index add7dec7..dc80ca5c 100644 --- a/apps/client/src/features/group/components/group-list.tsx +++ b/apps/client/src/features/group/components/group-list.tsx @@ -4,11 +4,10 @@ import React from "react"; import { Link } from "react-router-dom"; import { IconGroupCircle } from "@/components/icons/icon-people-circle.tsx"; import { useTranslation } from "react-i18next"; +import { formatMemberCount } from "@/lib"; export default function GroupList() { - const { t } = useTranslation("settings", { - keyPrefix: "workspace.group", - }); + const { t } = useTranslation(["group"]); const { data, isLoading } = useGetGroupsQuery(); return ( @@ -61,7 +60,7 @@ export default function GroupList() { component={Link} to={`/settings/groups/${group.id}`} > - {group.memberCount} members + {formatMemberCount(group.memberCount, t)} diff --git a/apps/client/src/features/group/components/group-members.tsx b/apps/client/src/features/group/components/group-members.tsx index 4cd24d8a..b5120604 100644 --- a/apps/client/src/features/group/components/group-members.tsx +++ b/apps/client/src/features/group/components/group-members.tsx @@ -12,9 +12,7 @@ import useUserRole from "@/hooks/use-user-role.tsx"; import { useTranslation } from "react-i18next"; export default function GroupMembersList() { - const { t } = useTranslation("settings", { - keyPrefix: "workspace.group", - }); + const { t } = useTranslation("group"); const { groupId } = useParams(); const { data, isLoading } = useGroupMembersQuery(groupId); const removeGroupMember = useRemoveGroupMemberMutation(); diff --git a/apps/client/src/features/group/components/multi-group-select.tsx b/apps/client/src/features/group/components/multi-group-select.tsx index af750823..5bb25a42 100644 --- a/apps/client/src/features/group/components/multi-group-select.tsx +++ b/apps/client/src/features/group/components/multi-group-select.tsx @@ -30,9 +30,7 @@ export function MultiGroupSelect({ description, mt, }: MultiGroupSelectProps) { - const { t } = useTranslation("settings", { - keyPrefix: "workspace.group", - }); + const { t } = useTranslation("group"); const [searchValue, setSearchValue] = useState(""); const [debouncedQuery] = useDebouncedValue(searchValue, 500); const { data: groups, isLoading } = useGetGroupsQuery({ diff --git a/apps/client/src/features/group/components/multi-user-select.tsx b/apps/client/src/features/group/components/multi-user-select.tsx index b3948a05..d5c83e54 100644 --- a/apps/client/src/features/group/components/multi-user-select.tsx +++ b/apps/client/src/features/group/components/multi-user-select.tsx @@ -30,9 +30,7 @@ const renderMultiSelectOption: MultiSelectProps["renderOption"] = ({ ); export function MultiUserSelect({ onChange, label }: MultiUserSelectProps) { - const { t } = useTranslation("settings", { - keyPrefix: "workspace.group", - }); + const { t } = useTranslation("group"); const [searchValue, setSearchValue] = useState(""); const [debouncedQuery] = useDebouncedValue(searchValue, 500); const { data: users, isLoading } = useWorkspaceMembersQuery({ diff --git a/apps/client/src/lib/utils.ts b/apps/client/src/lib/utils.ts index b4c3cb64..d6773d24 100644 --- a/apps/client/src/lib/utils.ts +++ b/apps/client/src/lib/utils.ts @@ -2,9 +2,9 @@ import { TFunction } from "i18next"; export function formatMemberCount(memberCount: number, t: TFunction): string { if (memberCount === 1) { - return `1 ${t('member')}`; + return `1 ${t("member")}`; } else { - return `${memberCount} ${t('members')}`; + return `${memberCount} ${t("members")}`; } } diff --git a/apps/client/src/pages/settings/group/group-info.tsx b/apps/client/src/pages/settings/group/group-info.tsx index 5d2fdb5f..1db1754e 100644 --- a/apps/client/src/pages/settings/group/group-info.tsx +++ b/apps/client/src/pages/settings/group/group-info.tsx @@ -4,9 +4,7 @@ import GroupDetails from "@/features/group/components/group-details"; import { useTranslation } from "react-i18next"; export default function GroupInfo() { - const { t } = useTranslation("settings", { - keyPrefix: "workspace.group", - }); + const { t } = useTranslation("group"); return ( <> diff --git a/apps/client/src/pages/settings/group/groups.tsx b/apps/client/src/pages/settings/group/groups.tsx index 76563069..937d3a4b 100644 --- a/apps/client/src/pages/settings/group/groups.tsx +++ b/apps/client/src/pages/settings/group/groups.tsx @@ -6,9 +6,7 @@ import useUserRole from "@/hooks/use-user-role.tsx"; import { useTranslation } from "react-i18next"; export default function Groups() { - const { t } = useTranslation("settings", { - keyPrefix: "workspace.group", - }); + const { t } = useTranslation("group"); const { isAdmin } = useUserRole(); return (