perf: i18n (#4740)
* feat: login limit time config * doc * perf: code * i18n update * update lock * fix: ts * update package
This commit is contained in:
@@ -338,7 +338,7 @@ const DatasetImportContextProvider = ({ children }: { children: React.ReactNode
|
||||
})
|
||||
}
|
||||
/>
|
||||
{t('common:common.Exit')}
|
||||
{t('common:Exit')}
|
||||
</Flex>
|
||||
) : (
|
||||
<Button
|
||||
@@ -346,7 +346,7 @@ const DatasetImportContextProvider = ({ children }: { children: React.ReactNode
|
||||
leftIcon={<MyIcon name={'common/backFill'} w={'14px'} />}
|
||||
onClick={goToPrevious}
|
||||
>
|
||||
{t('common:common.Last Step')}
|
||||
{t('common:last_step')}
|
||||
</Button>
|
||||
)}
|
||||
<Box flex={1} />
|
||||
|
||||
@@ -106,7 +106,7 @@ function DataProcess() {
|
||||
goToNext();
|
||||
}}
|
||||
>
|
||||
{t('common:common.Next Step')}
|
||||
{t('common:next_step')}
|
||||
</Button>
|
||||
</Flex>
|
||||
</Accordion>
|
||||
|
||||
@@ -167,7 +167,7 @@ const PreviewData = () => {
|
||||
</Flex>
|
||||
</Flex>
|
||||
<Flex mt={2} justifyContent={'flex-end'}>
|
||||
<Button onClick={goToNext}>{t('common:common.Next Step')}</Button>
|
||||
<Button onClick={goToNext}>{t('common:next_step')}</Button>
|
||||
</Flex>
|
||||
</Flex>
|
||||
);
|
||||
|
||||
@@ -184,7 +184,7 @@ const Upload = () => {
|
||||
title:
|
||||
importSource === ImportDataSourceEnum.reTraining
|
||||
? t('dataset:retrain_task_submitted')
|
||||
: t('common:core.dataset.import.Import success'),
|
||||
: t('common:core.dataset.import.import_success'),
|
||||
status: 'success'
|
||||
});
|
||||
}
|
||||
@@ -227,7 +227,7 @@ const Upload = () => {
|
||||
{t('common:core.dataset.import.Upload status')}
|
||||
</Th>
|
||||
<Th borderRightRadius={'md'} borderBottom={'none'} py={4}>
|
||||
{t('common:common.Action')}
|
||||
{t('common:Action')}
|
||||
</Th>
|
||||
</Tr>
|
||||
</Thead>
|
||||
@@ -247,20 +247,20 @@ const Upload = () => {
|
||||
{item.errorMsg ? (
|
||||
<Tooltip label={item.errorMsg} fontSize="md">
|
||||
<Flex alignItems="center">
|
||||
<MyTag colorSchema={'red'}>{t('common:common.Error')}</MyTag>
|
||||
<MyTag colorSchema={'red'}>{t('common:Error')}</MyTag>
|
||||
<QuestionOutlineIcon ml={2} color="red.500" w="14px" />
|
||||
</Flex>
|
||||
</Tooltip>
|
||||
) : (
|
||||
<>
|
||||
{item.createStatus === 'waiting' && (
|
||||
<MyTag colorSchema={'gray'}>{t('common:common.Waiting')}</MyTag>
|
||||
<MyTag colorSchema={'gray'}>{t('common:Waiting')}</MyTag>
|
||||
)}
|
||||
{item.createStatus === 'creating' && (
|
||||
<MyTag colorSchema={'blue'}>{t('common:common.Creating')}</MyTag>
|
||||
<MyTag colorSchema={'blue'}>{t('common:Creating')}</MyTag>
|
||||
)}
|
||||
{item.createStatus === 'finish' && (
|
||||
<MyTag colorSchema={'green'}>{t('common:common.Finish')}</MyTag>
|
||||
<MyTag colorSchema={'green'}>{t('common:Finish')}</MyTag>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { uploadFile2DB } from '@/web/common/file/controller';
|
||||
import { BucketNameEnum } from '@fastgpt/global/common/file/constants';
|
||||
import { ImportSourceItemType } from '@/web/core/dataset/type';
|
||||
import { useI18n } from '@/web/context/I18n';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import { DatasetPageContext } from '@/web/core/dataset/context/datasetPageContext';
|
||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
@@ -39,7 +38,6 @@ const FileSelector = ({
|
||||
onFinishSelect: () => void;
|
||||
} & FlexProps) => {
|
||||
const { t } = useTranslation();
|
||||
const { fileT } = useI18n();
|
||||
|
||||
const { toast } = useToast();
|
||||
const { feConfigs } = useSystemStore();
|
||||
@@ -157,7 +155,7 @@ const FileSelector = ({
|
||||
files = files.slice(0, maxCount - selectFiles.length);
|
||||
toast({
|
||||
status: 'warning',
|
||||
title: fileT('some_file_count_exceeds_limit', { maxCount })
|
||||
title: t('file:some_file_count_exceeds_limit', { maxCount })
|
||||
});
|
||||
}
|
||||
// size check
|
||||
@@ -169,13 +167,13 @@ const FileSelector = ({
|
||||
if (filterFiles.length < files.length) {
|
||||
toast({
|
||||
status: 'warning',
|
||||
title: fileT('some_file_size_exceeds_limit', { maxSize: formatFileSize(maxSize) })
|
||||
title: t('file:some_file_size_exceeds_limit', { maxSize: formatFileSize(maxSize) })
|
||||
});
|
||||
}
|
||||
|
||||
return onSelectFile(filterFiles);
|
||||
},
|
||||
[fileT, maxCount, maxSize, onSelectFile, selectFiles.length, toast]
|
||||
[t, maxCount, maxSize, onSelectFile, selectFiles.length, toast]
|
||||
);
|
||||
|
||||
const handleDragEnter = (e: DragEvent<HTMLDivElement>) => {
|
||||
@@ -270,7 +268,7 @@ const FileSelector = ({
|
||||
);
|
||||
} else {
|
||||
return toast({
|
||||
title: fileT('upload_error_description'),
|
||||
title: t('file:upload_error_description'),
|
||||
status: 'error'
|
||||
});
|
||||
}
|
||||
@@ -318,18 +316,18 @@ const FileSelector = ({
|
||||
<>
|
||||
<Box fontWeight={'bold'}>
|
||||
{isDragging
|
||||
? fileT('release_the_mouse_to_upload_the_file')
|
||||
: fileT('select_and_drag_file_tip')}
|
||||
? t('file:release_the_mouse_to_upload_the_file')
|
||||
: t('file:select_and_drag_file_tip')}
|
||||
</Box>
|
||||
{/* file type */}
|
||||
<Box color={'myGray.500'} fontSize={'xs'}>
|
||||
{fileT('support_file_type', { fileType })}
|
||||
{t('file:support_file_type', { fileType })}
|
||||
</Box>
|
||||
<Box color={'myGray.500'} fontSize={'xs'}>
|
||||
{/* max count */}
|
||||
{maxCount && fileT('support_max_count', { maxCount })}
|
||||
{maxCount && t('file:support_max_count', { maxCount })}
|
||||
{/* max size */}
|
||||
{maxSize && fileT('support_max_size', { maxSize: formatFileSize(maxSize) })}
|
||||
{maxSize && t('file:support_max_size', { maxSize: formatFileSize(maxSize) })}
|
||||
</Box>
|
||||
|
||||
<File
|
||||
|
||||
@@ -55,7 +55,7 @@ const FileModeSelector = ({ onClose }: { onClose: () => void }) => {
|
||||
})
|
||||
}
|
||||
>
|
||||
{t('common:common.Confirm')}
|
||||
{t('common:Confirm')}
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
</MyModal>
|
||||
|
||||
@@ -15,10 +15,8 @@ import {
|
||||
import { ImportSourceItemType } from '@/web/core/dataset/type.d';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useI18n } from '@/web/context/I18n';
|
||||
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
||||
import MyTag from '@fastgpt/web/components/common/Tag/index';
|
||||
import { QuestionOutlineIcon } from '@chakra-ui/icons';
|
||||
|
||||
export const RenderUploadFiles = ({
|
||||
files,
|
||||
@@ -28,7 +26,6 @@ export const RenderUploadFiles = ({
|
||||
setFiles: React.Dispatch<React.SetStateAction<ImportSourceItemType[]>>;
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const { fileT } = useI18n();
|
||||
|
||||
return files.length > 0 ? (
|
||||
<>
|
||||
@@ -37,16 +34,16 @@ export const RenderUploadFiles = ({
|
||||
<Thead draggable={false}>
|
||||
<Tr bg={'myGray.100'} mb={2}>
|
||||
<Th borderLeftRadius={'md'} borderBottom={'none'} py={4}>
|
||||
{fileT('file_name')}
|
||||
{t('file:file_name')}
|
||||
</Th>
|
||||
<Th borderBottom={'none'} py={4}>
|
||||
{t('common:core.dataset.import.Upload file progress')}
|
||||
</Th>
|
||||
<Th borderBottom={'none'} py={4}>
|
||||
{fileT('file_size')}
|
||||
{t('file:file_size')}
|
||||
</Th>
|
||||
<Th borderRightRadius={'md'} borderBottom={'none'} py={4}>
|
||||
{t('common:common.Action')}
|
||||
{t('common:Action')}
|
||||
</Th>
|
||||
</Tr>
|
||||
</Thead>
|
||||
@@ -63,7 +60,7 @@ export const RenderUploadFiles = ({
|
||||
{item.errorMsg ? (
|
||||
<MyTooltip label={item.errorMsg}>
|
||||
<MyTag colorSchema={'red'}>
|
||||
<Box mr={1}>{t('common:common.Error')}</Box>
|
||||
<Box mr={1}>{t('common:Error')}</Box>
|
||||
<MyIcon name={'help'} w={'0.9rem'} color={'red.500'} />
|
||||
</MyTag>
|
||||
</MyTooltip>
|
||||
|
||||
@@ -277,7 +277,7 @@ const CustomAPIFileInput = () => {
|
||||
{selectFiles.length > 0
|
||||
? `${t('dataset:total_num_files', { total: selectFiles.length })} | `
|
||||
: ''}
|
||||
{t('common:common.Next Step')}
|
||||
{t('common:next_step')}
|
||||
</Button>
|
||||
</Box>
|
||||
</Flex>
|
||||
|
||||
@@ -180,7 +180,7 @@ const CustomLinkInput = () => {
|
||||
goToNext();
|
||||
})}
|
||||
>
|
||||
{t('common:common.Next Step')}
|
||||
{t('common:next_step')}
|
||||
</Button>
|
||||
</Flex>
|
||||
</Box>
|
||||
|
||||
@@ -99,9 +99,7 @@ const CustomTextInput = () => {
|
||||
/>
|
||||
</Box>
|
||||
<Flex mt={5} justifyContent={'flex-end'}>
|
||||
<Button onClick={handleSubmit((data) => onSubmit(data))}>
|
||||
{t('common:common.Next Step')}
|
||||
</Button>
|
||||
<Button onClick={handleSubmit((data) => onSubmit(data))}>{t('common:next_step')}</Button>
|
||||
</Flex>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -147,7 +147,7 @@ const CustomLinkImport = () => {
|
||||
goToNext();
|
||||
})}
|
||||
>
|
||||
{t('common:common.Next Step')}
|
||||
{t('common:next_step')}
|
||||
</Button>
|
||||
</Flex>
|
||||
</Box>
|
||||
|
||||
@@ -71,7 +71,7 @@ const SelectFile = React.memo(function SelectFile() {
|
||||
{selectFiles.length > 0
|
||||
? `${t('dataset:total_num_files', { total: selectFiles.length })} | `
|
||||
: ''}
|
||||
{t('common:common.Next Step')}
|
||||
{t('common:next_step')}
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
@@ -93,7 +93,7 @@ const SelectFile = React.memo(function SelectFile() {
|
||||
{selectFiles.length > 0
|
||||
? `${t('dataset:total_num_files', { total: selectFiles.length })} | `
|
||||
: ''}
|
||||
{t('common:common.Next Step')}
|
||||
{t('common:next_step')}
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
Reference in New Issue
Block a user