feat: update group translation

This commit is contained in:
lleohao
2024-09-03 02:59:17 +00:00
parent 055f45a483
commit 909b470df9
17 changed files with 86 additions and 109 deletions

View File

@ -1 +1,34 @@
{} {
"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"
}

View File

@ -48,40 +48,7 @@
"Failed to update data": "Failed to update data" "Failed to update data": "Failed to update data"
}, },
"member": {}, "member": {},
"group": { "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"
},
"space": {} "space": {}
} }
} }

View File

@ -1 +1,34 @@
{} {
"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": "未找到群组"
}

View File

@ -48,40 +48,7 @@
"Failed to update data": "数据更新失败" "Failed to update data": "数据更新失败"
}, },
"member": {}, "member": {},
"group": { "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": "未找到群组"
},
"space": {} "space": {}
} }
} }

View File

@ -7,9 +7,7 @@ import { useAddGroupMemberMutation } from "@/features/group/queries/group-query.
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
export default function AddGroupMemberModal() { export default function AddGroupMemberModal() {
const { t } = useTranslation("settings", { const { t } = useTranslation("group");
keyPrefix: "workspace.group",
});
const { groupId } = useParams(); const { groupId } = useParams();
const [opened, { open, close }] = useDisclosure(false); const [opened, { open, close }] = useDisclosure(false);
const [userIds, setUserIds] = useState<string[]>([]); const [userIds, setUserIds] = useState<string[]>([]);

View File

@ -15,9 +15,7 @@ const formSchema = z.object({
type FormValues = z.infer<typeof formSchema>; type FormValues = z.infer<typeof formSchema>;
export function CreateGroupForm() { export function CreateGroupForm() {
const { t } = useTranslation("settings", { const { t } = useTranslation("group");
keyPrefix: "workspace.group",
});
const createGroupMutation = useCreateGroupMutation(); const createGroupMutation = useCreateGroupMutation();
const [userIds, setUserIds] = useState<string[]>([]); const [userIds, setUserIds] = useState<string[]>([]);
const navigate = useNavigate(); const navigate = useNavigate();

View File

@ -4,9 +4,7 @@ import { CreateGroupForm } from "@/features/group/components/create-group-form.t
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
export default function CreateGroupModal() { export default function CreateGroupModal() {
const { t } = useTranslation("settings", { const { t } = useTranslation("group");
keyPrefix: "workspace.group",
});
const [opened, { open, close }] = useDisclosure(false); const [opened, { open, close }] = useDisclosure(false);
return ( return (

View File

@ -19,9 +19,7 @@ interface EditGroupFormProps {
onClose?: () => void; onClose?: () => void;
} }
export function EditGroupForm({ onClose }: EditGroupFormProps) { export function EditGroupForm({ onClose }: EditGroupFormProps) {
const { t } = useTranslation("settings", { const { t } = useTranslation("group");
keyPrefix: "workspace.group",
});
const updateGroupMutation = useUpdateGroupMutation(); const updateGroupMutation = useUpdateGroupMutation();
const { isSuccess } = updateGroupMutation; const { isSuccess } = updateGroupMutation;
const { groupId } = useParams(); const { groupId } = useParams();

View File

@ -11,9 +11,7 @@ export default function EditGroupModal({
opened, opened,
onClose, onClose,
}: EditGroupModalProps) { }: EditGroupModalProps) {
const { t } = useTranslation("settings", { const { t } = useTranslation("group");
keyPrefix: "workspace.group",
});
return ( return (
<> <>

View File

@ -12,9 +12,7 @@ import { modals } from "@mantine/modals";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
export default function GroupActionMenu() { export default function GroupActionMenu() {
const { t } = useTranslation("settings", { const { t } = useTranslation("group");
keyPrefix: "workspace.group",
});
const { groupId } = useParams(); const { groupId } = useParams();
const { data: group, isLoading } = useGroupQuery(groupId); const { data: group, isLoading } = useGroupQuery(groupId);
const deleteGroupMutation = useDeleteGroupMutation(); const deleteGroupMutation = useDeleteGroupMutation();

View File

@ -4,11 +4,10 @@ import React from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { IconGroupCircle } from "@/components/icons/icon-people-circle.tsx"; import { IconGroupCircle } from "@/components/icons/icon-people-circle.tsx";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { formatMemberCount } from "@/lib";
export default function GroupList() { export default function GroupList() {
const { t } = useTranslation("settings", { const { t } = useTranslation(["group"]);
keyPrefix: "workspace.group",
});
const { data, isLoading } = useGetGroupsQuery(); const { data, isLoading } = useGetGroupsQuery();
return ( return (
@ -61,7 +60,7 @@ export default function GroupList() {
component={Link} component={Link}
to={`/settings/groups/${group.id}`} to={`/settings/groups/${group.id}`}
> >
{group.memberCount} members {formatMemberCount(group.memberCount, t)}
</Anchor> </Anchor>
</Table.Td> </Table.Td>
</Table.Tr> </Table.Tr>

View File

@ -12,9 +12,7 @@ import useUserRole from "@/hooks/use-user-role.tsx";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
export default function GroupMembersList() { export default function GroupMembersList() {
const { t } = useTranslation("settings", { const { t } = useTranslation("group");
keyPrefix: "workspace.group",
});
const { groupId } = useParams(); const { groupId } = useParams();
const { data, isLoading } = useGroupMembersQuery(groupId); const { data, isLoading } = useGroupMembersQuery(groupId);
const removeGroupMember = useRemoveGroupMemberMutation(); const removeGroupMember = useRemoveGroupMemberMutation();

View File

@ -30,9 +30,7 @@ export function MultiGroupSelect({
description, description,
mt, mt,
}: MultiGroupSelectProps) { }: MultiGroupSelectProps) {
const { t } = useTranslation("settings", { const { t } = useTranslation("group");
keyPrefix: "workspace.group",
});
const [searchValue, setSearchValue] = useState(""); const [searchValue, setSearchValue] = useState("");
const [debouncedQuery] = useDebouncedValue(searchValue, 500); const [debouncedQuery] = useDebouncedValue(searchValue, 500);
const { data: groups, isLoading } = useGetGroupsQuery({ const { data: groups, isLoading } = useGetGroupsQuery({

View File

@ -30,9 +30,7 @@ const renderMultiSelectOption: MultiSelectProps["renderOption"] = ({
); );
export function MultiUserSelect({ onChange, label }: MultiUserSelectProps) { export function MultiUserSelect({ onChange, label }: MultiUserSelectProps) {
const { t } = useTranslation("settings", { const { t } = useTranslation("group");
keyPrefix: "workspace.group",
});
const [searchValue, setSearchValue] = useState(""); const [searchValue, setSearchValue] = useState("");
const [debouncedQuery] = useDebouncedValue(searchValue, 500); const [debouncedQuery] = useDebouncedValue(searchValue, 500);
const { data: users, isLoading } = useWorkspaceMembersQuery({ const { data: users, isLoading } = useWorkspaceMembersQuery({

View File

@ -2,9 +2,9 @@ import { TFunction } from "i18next";
export function formatMemberCount(memberCount: number, t: TFunction): string { export function formatMemberCount(memberCount: number, t: TFunction): string {
if (memberCount === 1) { if (memberCount === 1) {
return `1 ${t('member')}`; return `1 ${t("member")}`;
} else { } else {
return `${memberCount} ${t('members')}`; return `${memberCount} ${t("members")}`;
} }
} }

View File

@ -4,9 +4,7 @@ import GroupDetails from "@/features/group/components/group-details";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
export default function GroupInfo() { export default function GroupInfo() {
const { t } = useTranslation("settings", { const { t } = useTranslation("group");
keyPrefix: "workspace.group",
});
return ( return (
<> <>

View File

@ -6,9 +6,7 @@ import useUserRole from "@/hooks/use-user-role.tsx";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
export default function Groups() { export default function Groups() {
const { t } = useTranslation("settings", { const { t } = useTranslation("group");
keyPrefix: "workspace.group",
});
const { isAdmin } = useUserRole(); const { isAdmin } = useUserRole();
return ( return (