perf: i18n (#4740)

* feat: login limit time config

* doc

* perf: code

* i18n update

* update lock

* fix: ts

* update package
This commit is contained in:
Archer
2025-05-05 16:16:59 +08:00
committed by GitHub
parent fdd4e9edbd
commit 864eff47c7
229 changed files with 1128 additions and 1293 deletions

View File

@@ -126,8 +126,8 @@ const CreateModal = ({ onClose, type }: { type: CreateAppType; onClose: () => vo
loadMyApps();
onClose();
},
successToast: t('common:common.Create Success'),
errorToast: t('common:common.Create Failed')
successToast: t('common:create_success'),
errorToast: t('common:create_failed')
}
);
@@ -142,10 +142,10 @@ const CreateModal = ({ onClose, type }: { type: CreateAppType; onClose: () => vo
>
<ModalBody>
<Box color={'myGray.800'} fontWeight={'bold'}>
{t('common:common.Set Name')}
{t('common:input_name')}
</Box>
<Flex mt={2} alignItems={'center'}>
<MyTooltip label={t('common:common.Set Avatar')}>
<MyTooltip label={t('common:set_avatar')}>
<Avatar
flexShrink={0}
src={avatar}
@@ -313,10 +313,7 @@ const CreateModal = ({ onClose, type }: { type: CreateAppType; onClose: () => vo
<ModalFooter gap={4}>
<Button variant={'whiteBase'} onClick={onClose}>
{t('common:common.Cancel')}
</Button>
<Button variant={'primary'} onClick={handleSubmit((data) => onclickCreate(data))}>
{t('common:common.Confirm')}
{t('common:Close')}
</Button>
</ModalFooter>

View File

@@ -98,8 +98,8 @@ const HttpPluginEditModal = ({
loadMyApps();
onClose();
},
successToast: t('common:common.Create Success'),
errorToast: t('common:common.Create Failed')
successToast: t('common:create_success'),
errorToast: t('common:create_failed')
});
const { mutate: updatePlugins, isLoading: isUpdating } = useRequest({
@@ -118,8 +118,8 @@ const HttpPluginEditModal = ({
loadMyApps();
onClose();
},
successToast: t('common:common.Update Success'),
errorToast: t('common:common.Update Failed')
successToast: t('common:update_success'),
errorToast: t('common:update_failed')
});
const {
@@ -178,10 +178,10 @@ const HttpPluginEditModal = ({
<ModalBody flex={'1 0 0'} overflow={'auto'}>
<>
<Box color={'myGray.800'} fontWeight={'bold'}>
{t('common:plugin.Set Name')}
{t('common:input_name')}
</Box>
<Flex mt={3} alignItems={'center'}>
<MyTooltip label={t('common:common.Set Avatar')}>
<MyTooltip label={t('common:set_avatar')}>
<Avatar
flexShrink={0}
src={avatar}
@@ -197,7 +197,7 @@ const HttpPluginEditModal = ({
ml={4}
bg={'myWhite.600'}
{...register('name', {
required: t('common:common.name_is_empty')
required: t('common:name_is_empty')
})}
/>
</Flex>
@@ -240,7 +240,7 @@ const HttpPluginEditModal = ({
isLoading={isLoadingUrlApi}
onClick={onClickUrlLoadApi}
>
{t('common:common.Import')}
{t('common:Import')}
</Button>
</Flex>
</Box>
@@ -432,7 +432,7 @@ const HttpPluginEditModal = ({
<ModalFooter>
<Button variant={'whiteBase'} mr={3} onClick={onClose}>
{t('common:common.Close')}
{t('common:Close')}
</Button>
{!isEdit ? (
<Button
@@ -440,7 +440,7 @@ const HttpPluginEditModal = ({
onClick={handleSubmit((data) => onCreate(data))}
isLoading={isCreating}
>
{t('common:common.Confirm Create')}
{t('common:comfirn_create')}
</Button>
) : (
<Button
@@ -448,7 +448,7 @@ const HttpPluginEditModal = ({
isLoading={isUpdating}
onClick={handleSubmit((data) => updatePlugins(data))}
>
{t('common:common.Confirm Update')}
{t('common:confirm_update')}
</Button>
)}
</ModalFooter>

View File

@@ -136,7 +136,7 @@ const JsonImportModal = ({ onClose }: { onClose: () => void }) => {
loadMyApps();
handleCloseJsonImportModal();
},
successToast: t('common:common.Create Success')
successToast: t('common:create_success')
}
);
@@ -151,10 +151,10 @@ const JsonImportModal = ({ onClose }: { onClose: () => void }) => {
>
<ModalBody>
<Box color={'myGray.800'} fontWeight={'bold'}>
{t('common:common.Set Name')}
{t('common:input_name')}
</Box>
<Flex mt={2} alignItems={'center'}>
<MyTooltip label={t('common:common.Set Avatar')}>
<MyTooltip label={t('common:set_avatar')}>
<Avatar
flexShrink={0}
src={selectedAvatar}
@@ -185,9 +185,9 @@ const JsonImportModal = ({ onClose }: { onClose: () => void }) => {
</ModalBody>
<ModalFooter gap={4}>
<Button variant={'whiteBase'} onClick={handleCloseJsonImportModal}>
{t('common:common.Cancel')}
{t('common:Cancel')}
</Button>
<Button onClick={handleSubmit(onSubmit)}>{t('common:common.Confirm')}</Button>
<Button onClick={handleSubmit(onSubmit)}>{t('common:Confirm')}</Button>
</ModalFooter>
</MyModal>
<File

View File

@@ -101,8 +101,8 @@ const ListItem = () => {
onSuccess() {
loadMyApps();
},
successToast: t('common:common.Delete Success'),
errorToast: t('common:common.Delete Failed')
successToast: t('common:delete_success'),
errorToast: t('common:delete_failed')
}
);
@@ -149,7 +149,7 @@ const ListItem = () => {
h="100%"
label={
app.type === AppTypeEnum.folder
? t('common:common.folder.Open folder')
? t('common:open_folder')
: app.permission.hasWritePer
? t('app:edit_app')
: t('app:go_to_chat')
@@ -217,7 +217,7 @@ const ListItem = () => {
color={'myGray.500'}
>
<Box className={'textEllipsis2'} whiteSpace={'pre-wrap'}>
{app.intro || t('common:common.no_intro')}
{app.intro || t('common:no_intro')}
</Box>
</Box>
<Flex
@@ -333,7 +333,7 @@ const ListItem = () => {
{
icon: 'common/file/move',
type: 'grayBg' as MenuItemType,
label: t('common:common.folder.Move to'),
label: t('common:move_to'),
onClick: () => setMoveAppId(app._id)
}
]),
@@ -375,7 +375,7 @@ const ListItem = () => {
{
type: 'danger' as 'danger',
icon: 'delete',
label: t('common:common.Delete'),
label: t('common:Delete'),
onClick: () =>
openConfirmDel(
() => onclickDelApp(app._id),

View File

@@ -73,8 +73,8 @@ const MCPToolsEditModal = ({ onClose }: { onClose: () => void }) => {
onClose();
loadMyApps();
},
successToast: t('common:common.Create Success'),
errorToast: t('common:common.Create Failed')
successToast: t('common:create_success'),
errorToast: t('common:create_failed')
}
);
@@ -109,10 +109,10 @@ const MCPToolsEditModal = ({ onClose }: { onClose: () => void }) => {
>
<ModalBody>
<Box color={'myGray.900'} fontSize={'14px'} fontWeight={'medium'}>
{t('common:common.Set Name')}
{t('common:input_name')}
</Box>
<Flex mt={2} alignItems={'center'}>
<MyTooltip label={t('common:common.Set Avatar')}>
<MyTooltip label={t('common:set_avatar')}>
<Avatar
flexShrink={0}
src={avatar}
@@ -128,7 +128,7 @@ const MCPToolsEditModal = ({ onClose }: { onClose: () => void }) => {
ml={4}
bg={'myWhite.600'}
{...register('name', {
required: t('common:common.name_is_empty')
required: t('common:name_is_empty')
})}
/>
</Flex>
@@ -153,7 +153,7 @@ const MCPToolsEditModal = ({ onClose }: { onClose: () => void }) => {
runGetMCPTools({ url: mcpData.url });
}}
>
{t('common:common.Parse')}
{t('common:Parse')}
</Button>
</Flex>
@@ -226,14 +226,14 @@ const MCPToolsEditModal = ({ onClose }: { onClose: () => void }) => {
</ModalBody>
<ModalFooter gap={2}>
<Button variant={'whitePrimary'} onClick={onClose}>
{t('common:common.Close')}
{t('common:Close')}
</Button>
<Button
isDisabled={mcpData.toolList.length === 0}
isLoading={isCreating}
onClick={handleSubmit(onCreate)}
>
{t('common:common.Confirm Create')}
{t('common:comfirn_create')}
</Button>
</ModalFooter>
</MyModal>

View File

@@ -1,6 +1,5 @@
import React, { useRef } from 'react';
import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
import { useI18n } from '@/web/context/I18n';
import MyIcon from '@fastgpt/web/components/common/Icon';
import { Box, Flex } from '@chakra-ui/react';
import { useTranslation } from 'next-i18next';

View File

@@ -238,7 +238,7 @@ const SelectAppModal = ({
</ModalBody>
<ModalFooter>
<Button ml="4" h={'32px'} onClick={() => onConfirm(selectedList)}>
{t('common:common.Confirm')}
{t('common:Confirm')}
</Button>
</ModalFooter>
</MyModal>
@@ -288,7 +288,7 @@ const EditMcpModal = ({
}),
{
manual: true,
successToast: t('common:common.Create Success'),
successToast: t('common:create_success'),
onSuccess
}
);
@@ -306,7 +306,7 @@ const EditMcpModal = ({
}),
{
manual: true,
successToast: t('common:common.Update Success'),
successToast: t('common:update_success'),
onSuccess
}
);
@@ -325,7 +325,7 @@ const EditMcpModal = ({
<ModalBody>
<Box>
<FormLabel required mb={0.5}>
{t('common:common.Input name')}
{t('common:input_name')}
</FormLabel>
<Input {...register('name', { required: true })} bg={'myGray.50'} />
</Box>
@@ -390,7 +390,7 @@ const EditMcpModal = ({
</ModalBody>
<ModalFooter>
<Button variant={'whiteBase'} mr={4} onClick={onClose}>
{t('common:common.Cancel')}
{t('common:Cancel')}
</Button>
<Button
isLoading={isConfirming}
@@ -403,7 +403,7 @@ const EditMcpModal = ({
return createMcp(data);
})}
>
{t('common:common.Confirm')}
{t('common:Confirm')}
</Button>
</ModalFooter>
</MyModal>