I18n Translations (#2267)
* rebase * i18n-1 * add error info i18n * fix * fix * refactor: 删除error.json * delete useI18n
This commit is contained in:
@@ -5,7 +5,7 @@ import type { PermissionValueType } from '@fastgpt/global/support/permission/typ
|
||||
import { ReadPermissionVal, WritePermissionVal } from '@fastgpt/global/support/permission/constant';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useConfirm } from '@fastgpt/web/hooks/useConfirm';
|
||||
import { useI18n } from '@/web/context/I18n';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
export enum defaultPermissionEnum {
|
||||
private = 'private',
|
||||
@@ -34,12 +34,11 @@ const DefaultPermissionList = ({
|
||||
...styles
|
||||
}: Props) => {
|
||||
const { ConfirmModal, openConfirm } = useConfirm({});
|
||||
const { commonT } = useI18n();
|
||||
|
||||
const { t } = useTranslation();
|
||||
const defaultPermissionSelectList = [
|
||||
{ label: '仅协作者访问', value: defaultPer },
|
||||
{ label: '团队可访问', value: readPer },
|
||||
{ label: '团队可编辑', value: writePer }
|
||||
{ label: t('user:permission.only_collaborators'), value: defaultPer },
|
||||
{ label: t('user:permission.team_read'), value: readPer },
|
||||
{ label: t('user:permission.team_write'), value: writePer }
|
||||
];
|
||||
|
||||
const { runAsync: onRequestChange, loading } = useRequest2((v: PermissionValueType) =>
|
||||
@@ -58,7 +57,7 @@ const DefaultPermissionList = ({
|
||||
openConfirm(
|
||||
() => onRequestChange(per),
|
||||
undefined,
|
||||
commonT('permission.Remove InheritPermission Confirm')
|
||||
t('common:permission.Remove InheritPermission Confirm')
|
||||
)();
|
||||
} else {
|
||||
return onRequestChange(per);
|
||||
|
||||
@@ -79,7 +79,13 @@ function AddMemberModal({ onClose }: AddModalPropsType) {
|
||||
});
|
||||
|
||||
return (
|
||||
<MyModal isOpen onClose={onClose} iconSrc="modal/AddClb" title="添加协作者" minW="800px">
|
||||
<MyModal
|
||||
isOpen
|
||||
onClose={onClose}
|
||||
iconSrc="modal/AddClb"
|
||||
title={t('user:team.add_collaborator')}
|
||||
minW="800px"
|
||||
>
|
||||
<ModalBody>
|
||||
<MyBox
|
||||
isLoading={loadingMembers}
|
||||
@@ -103,7 +109,7 @@ function AddMemberModal({ onClose }: AddModalPropsType) {
|
||||
<MyIcon name="common/searchLight" w="16px" color={'myGray.500'} />
|
||||
</InputLeftElement>
|
||||
<Input
|
||||
placeholder="搜索用户名"
|
||||
placeholder={t('user:search_user')}
|
||||
bgColor="myGray.50"
|
||||
onChange={(e) => setSearchText(e.target.value)}
|
||||
/>
|
||||
@@ -156,7 +162,9 @@ function AddMemberModal({ onClose }: AddModalPropsType) {
|
||||
</Flex>
|
||||
</Flex>
|
||||
<Flex p="4" flexDirection="column">
|
||||
<Box>已选: {selectedMemberIdList.length}</Box>
|
||||
<Box>
|
||||
{t('user:has_chosen') + ': '}+ {selectedMemberIdList.length}
|
||||
</Box>
|
||||
<Flex flexDirection="column" mt="2">
|
||||
{selectedMemberIdList.map((tmbId) => {
|
||||
const member = filterMembers.find((v) => v.tmbId === tmbId);
|
||||
@@ -211,7 +219,7 @@ function AddMemberModal({ onClose }: AddModalPropsType) {
|
||||
onChange={(v) => setSelectedPermission(v)}
|
||||
/>
|
||||
<Button isLoading={isUpdating} ml="4" h={'32px'} onClick={onConfirm}>
|
||||
确认
|
||||
{t('common:common.Confirm')}
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
</MyModal>
|
||||
|
||||
@@ -23,12 +23,13 @@ import { PermissionValueType } from '@fastgpt/global/support/permission/type';
|
||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
|
||||
import Loading from '@fastgpt/web/components/common/MyLoading';
|
||||
|
||||
import { useTranslation } from 'next-i18next';
|
||||
export type ManageModalProps = {
|
||||
onClose: () => void;
|
||||
};
|
||||
|
||||
function ManageModal({ onClose }: ManageModalProps) {
|
||||
const { t } = useTranslation();
|
||||
const { userInfo } = useUserStore();
|
||||
const { permission, collaboratorList, onUpdateCollaborators, onDelOneCollaborator } =
|
||||
useContextSelector(CollaboratorContext, (v) => v);
|
||||
@@ -44,23 +45,29 @@ function ManageModal({ onClose }: ManageModalProps) {
|
||||
permission: per
|
||||
});
|
||||
},
|
||||
successToast: '更新成功',
|
||||
successToast: t('common.Update Success'),
|
||||
errorToast: 'Error'
|
||||
});
|
||||
|
||||
const loading = isDeleting || isUpdating;
|
||||
|
||||
return (
|
||||
<MyModal isOpen onClose={onClose} minW="600px" title="管理协作者" iconSrc="common/settingLight">
|
||||
<MyModal
|
||||
isOpen
|
||||
onClose={onClose}
|
||||
minW="600px"
|
||||
title={t('user:team.manage_collaborators')}
|
||||
iconSrc="common/settingLight"
|
||||
>
|
||||
<ModalBody>
|
||||
<TableContainer borderRadius="md" minH="400px">
|
||||
<Table>
|
||||
<Thead bg="myGray.100">
|
||||
<Tr>
|
||||
<Th border="none">名称</Th>
|
||||
<Th border="none">权限</Th>
|
||||
<Th border="none">{t('user:name')}</Th>
|
||||
<Th border="none">{t('user:permissions')}</Th>
|
||||
<Th border="none" w={'40px'}>
|
||||
操作
|
||||
{t('user:operations')}
|
||||
</Th>
|
||||
</Tr>
|
||||
</Thead>
|
||||
@@ -109,7 +116,7 @@ function ManageModal({ onClose }: ManageModalProps) {
|
||||
})}
|
||||
</Tbody>
|
||||
</Table>
|
||||
{collaboratorList?.length === 0 && <EmptyTip text={'暂无协作者'} />}
|
||||
{collaboratorList?.length === 0 && <EmptyTip text={t('user:team.no_collaborators')} />}
|
||||
</TableContainer>
|
||||
{loading && <Loading fixed={false} />}
|
||||
</ModalBody>
|
||||
|
||||
Reference in New Issue
Block a user