perf: i18n (#4740)
* feat: login limit time config * doc * perf: code * i18n update * update lock * fix: ts * update package
This commit is contained in:
@@ -103,7 +103,7 @@ const ApiKeyTable = ({ tips, appId }: { tips: string; appId?: string }) => {
|
||||
color={'primary.500'}
|
||||
fontSize={'sm'}
|
||||
>
|
||||
{t('common:common.Read document')}
|
||||
{t('common:read_doc')}
|
||||
</Link>
|
||||
)}
|
||||
</Flex>
|
||||
@@ -153,12 +153,12 @@ const ApiKeyTable = ({ tips, appId }: { tips: string; appId?: string }) => {
|
||||
<Th>{t('common:support.outlink.Usage points')}</Th>
|
||||
{feConfigs?.isPlus && (
|
||||
<>
|
||||
<Th>{t('common:common.Expired Time')}</Th>
|
||||
<Th>{t('common:expired_time')}</Th>
|
||||
</>
|
||||
)}
|
||||
|
||||
<Th>{t('common:common.Create Time')}</Th>
|
||||
<Th>{t('common:common.Last use time')}</Th>
|
||||
<Th>{t('common:create_time')}</Th>
|
||||
<Th>{t('common:last_use_time')}</Th>
|
||||
<Th />
|
||||
</Tr>
|
||||
</Thead>
|
||||
@@ -171,7 +171,7 @@ const ApiKeyTable = ({ tips, appId }: { tips: string; appId?: string }) => {
|
||||
{Math.round(usagePoints)}/
|
||||
{feConfigs?.isPlus && limit?.maxUsagePoints && limit?.maxUsagePoints > -1
|
||||
? `${limit?.maxUsagePoints}`
|
||||
: t('common:common.Unlimited')}
|
||||
: t('common:Unlimited')}
|
||||
</Td>
|
||||
{feConfigs?.isPlus && (
|
||||
<>
|
||||
@@ -186,7 +186,7 @@ const ApiKeyTable = ({ tips, appId }: { tips: string; appId?: string }) => {
|
||||
<Td whiteSpace={'pre-wrap'}>
|
||||
{lastUsedTime
|
||||
? dayjs(lastUsedTime).format('YYYY/MM/DD\nHH:mm:ss')
|
||||
: t('common:common.Un used')}
|
||||
: t('common:un_used')}
|
||||
</Td>
|
||||
<Td>
|
||||
<MyMenu
|
||||
@@ -204,7 +204,7 @@ const ApiKeyTable = ({ tips, appId }: { tips: string; appId?: string }) => {
|
||||
{
|
||||
children: [
|
||||
{
|
||||
label: t('common:common.Edit'),
|
||||
label: t('common:Edit'),
|
||||
icon: 'edit',
|
||||
onClick: () =>
|
||||
setEditData({
|
||||
@@ -215,7 +215,7 @@ const ApiKeyTable = ({ tips, appId }: { tips: string; appId?: string }) => {
|
||||
})
|
||||
},
|
||||
{
|
||||
label: t('common:common.Delete'),
|
||||
label: t('common:Delete'),
|
||||
icon: 'delete',
|
||||
type: 'danger',
|
||||
onClick: () => openConfirm(() => onclickRemove(_id))()
|
||||
@@ -279,7 +279,7 @@ const ApiKeyTable = ({ tips, appId }: { tips: string; appId?: string }) => {
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button variant="whiteBase" onClick={() => setApiKey('')}>
|
||||
{t('common:common.OK')}
|
||||
{t('common:OK')}
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
</MyModal>
|
||||
@@ -340,7 +340,7 @@ function EditKeyModal({
|
||||
placeholder={t('publish:key_alias') || 'key_alias'}
|
||||
maxLength={100}
|
||||
{...register('name', {
|
||||
required: t('common:common.name_is_empty') || 'name_is_empty'
|
||||
required: t('common:name_is_empty') || 'name_is_empty'
|
||||
})}
|
||||
/>
|
||||
</Flex>
|
||||
@@ -364,7 +364,7 @@ function EditKeyModal({
|
||||
/>
|
||||
</Flex>
|
||||
<Flex alignItems={'center'} mt={4}>
|
||||
<FormLabel flex={'0 0 90px'}>{t('common:common.Expired Time')}</FormLabel>
|
||||
<FormLabel flex={'0 0 90px'}>{t('common:expired_time')}</FormLabel>
|
||||
<Input
|
||||
type="datetime-local"
|
||||
defaultValue={
|
||||
@@ -383,14 +383,14 @@ function EditKeyModal({
|
||||
|
||||
<ModalFooter>
|
||||
<Button variant={'whiteBase'} mr={3} onClick={onClose}>
|
||||
{t('common:common.Close')}
|
||||
{t('common:Close')}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
isLoading={creating || updating}
|
||||
onClick={submitShareChat((data) => (isEdit ? onclickUpdate(data) : onclickCreate(data)))}
|
||||
>
|
||||
{t('common:common.Confirm')}
|
||||
{t('common:Confirm')}
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
</MyModal>
|
||||
|
||||
@@ -91,8 +91,8 @@ const LafAccountModal = ({
|
||||
initUserInfo();
|
||||
onClose();
|
||||
},
|
||||
successToast: t('common:common.Update Success'),
|
||||
errorToast: t('common:common.Update Failed')
|
||||
successToast: t('common:update_success'),
|
||||
errorToast: t('common:update_failed')
|
||||
});
|
||||
|
||||
return (
|
||||
@@ -180,11 +180,11 @@ const LafAccountModal = ({
|
||||
onClose();
|
||||
}}
|
||||
>
|
||||
{t('common:common.Close')}
|
||||
{t('common:Close')}
|
||||
</Button>
|
||||
{appid && (
|
||||
<Button ml={3} isLoading={isUpdating} onClick={handleSubmit((data) => onSubmit(data))}>
|
||||
{t('common:common.Update')}
|
||||
{t('common:Update')}
|
||||
</Button>
|
||||
)}
|
||||
</ModalFooter>
|
||||
|
||||
@@ -166,9 +166,9 @@ export function ChangeOwnerModal({
|
||||
<ModalFooter>
|
||||
<HStack>
|
||||
<Button onClick={onClose} variant={'whiteBase'}>
|
||||
{t('common:common.Cancel')}
|
||||
{t('common:Cancel')}
|
||||
</Button>
|
||||
<Button onClick={onConfirm}>{t('common:common.Confirm')}</Button>
|
||||
<Button onClick={onConfirm}>{t('common:Confirm')}</Button>
|
||||
</HStack>
|
||||
</ModalFooter>
|
||||
</MyModal>
|
||||
|
||||
@@ -90,7 +90,7 @@ const ConfigPerModal = ({
|
||||
leftIcon={<MyIcon w="4" name="support/permission/collaborator" />}
|
||||
onClick={onOpenAddMember}
|
||||
>
|
||||
{t('common:common.Add')}
|
||||
{t('common:Add')}
|
||||
</Button>
|
||||
</Flex>
|
||||
</Flex>
|
||||
|
||||
@@ -27,7 +27,7 @@ function ManageModal({ onClose }: ManageModalProps) {
|
||||
const { runAsync: onDelete, loading: isDeleting } = useRequest2(onDelOneCollaborator);
|
||||
|
||||
const { runAsync: onUpdate, loading: isUpdating } = useRequest2(onUpdateCollaborators, {
|
||||
successToast: t('common.Update Success'),
|
||||
successToast: t('common:update_success'),
|
||||
errorToast: 'Error'
|
||||
});
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ function MemberModal({
|
||||
permission: addOnly ? undefined : selectedPermission!
|
||||
} as UpdateClbPermissionProps<ValueOf<typeof addOnly>>),
|
||||
{
|
||||
successToast: t('common:common.Add Success'),
|
||||
successToast: t('common:Add Success'),
|
||||
onSuccess() {
|
||||
onClose();
|
||||
}
|
||||
@@ -255,7 +255,7 @@ function MemberModal({
|
||||
onPathClick(parentId);
|
||||
}
|
||||
}}
|
||||
rootName={t('common:common.Team')}
|
||||
rootName={t('common:Team')}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
@@ -452,7 +452,7 @@ function MemberModal({
|
||||
</HStack>
|
||||
)}
|
||||
<Button isLoading={isUpdating} ml="4" h={'32px'} onClick={onConfirm}>
|
||||
{t('common:common.Confirm')}
|
||||
{t('common:Confirm')}
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
</MyModal>
|
||||
|
||||
@@ -239,7 +239,7 @@ function PermissionSelect({
|
||||
}}
|
||||
>
|
||||
<MyIcon name="delete" w="20px" color="red.600" />
|
||||
<Box color="red.600">{t('common:common.Remove')}</Box>
|
||||
<Box color="red.600">{t('common:Remove')}</Box>
|
||||
</HStack>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -17,8 +17,8 @@ import MemberListCard, { type MemberListCardProps } from './MemberListCard';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { useConfirm } from '@fastgpt/web/hooks/useConfirm';
|
||||
import { useI18n } from '@/web/context/I18n';
|
||||
import type { RequireOnlyOne } from '@fastgpt/global/common/type/utils';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
|
||||
const MemberModal = dynamic(() => import('./MemberModal'));
|
||||
const ManageModal = dynamic(() => import('./ManageModal'));
|
||||
@@ -89,6 +89,7 @@ const CollaboratorContextProvider = ({
|
||||
hasParent?: boolean;
|
||||
addPermissionOnly?: boolean;
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const onUpdateCollaboratorsThen = async (props: UpdateClbPermissionProps) => {
|
||||
await onUpdateCollaborators(props);
|
||||
refetchCollaboratorList();
|
||||
@@ -101,7 +102,6 @@ const CollaboratorContextProvider = ({
|
||||
};
|
||||
|
||||
const { feConfigs } = useSystemStore();
|
||||
const { commonT } = useI18n();
|
||||
|
||||
const {
|
||||
data: collaboratorList = [],
|
||||
@@ -187,7 +187,7 @@ const CollaboratorContextProvider = ({
|
||||
onOpenAddMember();
|
||||
},
|
||||
undefined,
|
||||
commonT('permission.Remove InheritPermission Confirm')
|
||||
t('common:permission.Remove InheritPermission Confirm')
|
||||
)();
|
||||
} else {
|
||||
onOpenAddMember();
|
||||
@@ -200,7 +200,7 @@ const CollaboratorContextProvider = ({
|
||||
onOpenManageModal();
|
||||
},
|
||||
undefined,
|
||||
commonT('permission.Remove InheritPermission Confirm')
|
||||
t('common:permission.Remove InheritPermission Confirm')
|
||||
)();
|
||||
} else {
|
||||
onOpenManageModal();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { useI18n } from '@/web/context/I18n';
|
||||
import { Box, BoxProps } from '@chakra-ui/react';
|
||||
import { useConfirm } from '@fastgpt/web/hooks/useConfirm';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
|
||||
const ResumeInherit = ({
|
||||
onResume,
|
||||
@@ -10,13 +10,13 @@ const ResumeInherit = ({
|
||||
}: BoxProps & {
|
||||
onResume?: () => Promise<any> | any;
|
||||
}) => {
|
||||
const { commonT } = useI18n();
|
||||
const { t } = useTranslation();
|
||||
const { toast } = useToast();
|
||||
const { ConfirmModal: CommonConfirmModal, openConfirm: openCommonConfirm } = useConfirm({});
|
||||
|
||||
return onResume ? (
|
||||
<Box display={'inline'} fontSize={'sm'} {...props}>
|
||||
{commonT('permission.No InheritPermission')}
|
||||
{t('common:permission.No InheritPermission')}
|
||||
<Box
|
||||
display={'inline'}
|
||||
textDecoration={'underline'}
|
||||
@@ -27,16 +27,16 @@ const ResumeInherit = ({
|
||||
() =>
|
||||
onResume()?.then(() => {
|
||||
toast({
|
||||
title: commonT('permission.Resume InheritPermission Success'),
|
||||
title: t('common:permission.Resume InheritPermission Success'),
|
||||
status: 'success'
|
||||
});
|
||||
}),
|
||||
undefined,
|
||||
commonT('permission.Resume InheritPermission Confirm')
|
||||
t('common:permission.Resume InheritPermission Confirm')
|
||||
)();
|
||||
}}
|
||||
>
|
||||
{commonT('click_to_resume')}
|
||||
{t('common:click_to_resume')}
|
||||
</Box>
|
||||
|
||||
<CommonConfirmModal />
|
||||
|
||||
@@ -115,14 +115,14 @@ const UpdateContactModal = ({
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button mr={3} variant={'whiteBase'} onClick={onClose}>
|
||||
{t('common:common.Cancel')}
|
||||
{t('common:Cancel')}
|
||||
</Button>
|
||||
<Button
|
||||
isLoading={isLoading}
|
||||
isDisabled={!account || !verifyCode}
|
||||
onClick={handleSubmit((data) => onSubmit(data))}
|
||||
>
|
||||
{t('common:common.Confirm')}
|
||||
{t('common:Confirm')}
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
</MyModal>
|
||||
|
||||
@@ -59,7 +59,7 @@ const SendCodeAuthModal = ({
|
||||
</ModalBody>
|
||||
<ModalFooter gap={2}>
|
||||
<Button isLoading={onSending} variant={'whiteBase'} onClick={onClose}>
|
||||
{t('common:common.Cancel')}
|
||||
{t('common:Cancel')}
|
||||
</Button>
|
||||
<Button
|
||||
isLoading={onSending}
|
||||
@@ -74,7 +74,7 @@ const SendCodeAuthModal = ({
|
||||
}
|
||||
)}
|
||||
>
|
||||
{t('common:common.Confirm')}
|
||||
{t('common:Confirm')}
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
</MyModal>
|
||||
|
||||
@@ -63,7 +63,7 @@ const TeamTagsAsync = ({ onClose }: { onClose: () => void }) => {
|
||||
initUserInfo();
|
||||
onClose();
|
||||
},
|
||||
errorToast: t('common:common.Create Failed')
|
||||
errorToast: t('common:create_failed')
|
||||
});
|
||||
const { mutate: onclickTagAsync, isLoading: isSyncing } = useRequest({
|
||||
mutationFn: (data: FormType) => loadTeamTagsByDomain(data.teamDomain),
|
||||
@@ -187,7 +187,7 @@ const TeamTagsAsync = ({ onClose }: { onClose: () => void }) => {
|
||||
</ModalBody>
|
||||
<ModalFooter mb={2}>
|
||||
<Button variant={'whiteBase'} mr={3} onClick={onClose}>
|
||||
{t('common:common.Close')}
|
||||
{t('common:Close')}
|
||||
</Button>
|
||||
<Button isLoading={isUpdating} onClick={handleSubmit((data) => onclickUpdate(data))}>
|
||||
{t('common:user.team.Tags Async')}
|
||||
|
||||
@@ -37,16 +37,11 @@ const NotSufficientModal = ({ type }: { type: NotSufficientModalType }) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<MyModal
|
||||
isOpen
|
||||
iconSrc="common/confirm/deleteTip"
|
||||
title={t('common:common.Warning')}
|
||||
w={'420px'}
|
||||
>
|
||||
<MyModal isOpen iconSrc="common/confirm/deleteTip" title={t('common:Warning')} w={'420px'}>
|
||||
<ModalBody>{textMap[type]}</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button variant={'whiteBase'} mr={2} onClick={onClose}>
|
||||
{t('common:common.Close')}
|
||||
{t('common:Close')}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
|
||||
Reference in New Issue
Block a user