mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-02 12:48:30 +00:00
feat: Optimize i18n keys and remove unused keys, supporting static files in I18nT (#2092)
* feat: packages web i18n * delete file * feat:i18n add i18nT * handle keys * delete unusedKeys * fix build * update dev.md
This commit is contained in:
@@ -184,7 +184,7 @@ const DataCard = () => {
|
||||
...(collection.tags
|
||||
? [
|
||||
{
|
||||
label: datasetT('Collection tags'),
|
||||
label: datasetT('collection_tags'),
|
||||
value: collection.tags?.join(', ') || '-'
|
||||
}
|
||||
]
|
||||
|
@@ -142,7 +142,7 @@ const Upload = () => {
|
||||
)
|
||||
);
|
||||
},
|
||||
errorToast: fileT('Upload failed')
|
||||
errorToast: fileT('upload_failed')
|
||||
});
|
||||
|
||||
return (
|
||||
|
@@ -132,7 +132,7 @@ const FileSelector = ({
|
||||
files = files.slice(0, maxCount - selectFiles.length);
|
||||
toast({
|
||||
status: 'warning',
|
||||
title: fileT('Some file count exceeds limit', { maxCount })
|
||||
title: fileT('some_file_count_exceeds_limit', { maxCount })
|
||||
});
|
||||
}
|
||||
// size check
|
||||
@@ -144,7 +144,7 @@ const FileSelector = ({
|
||||
if (filterFiles.length < files.length) {
|
||||
toast({
|
||||
status: 'warning',
|
||||
title: fileT('Some file size exceeds limit', { maxSize: formatFileSize(maxSize) })
|
||||
title: fileT('some_file_size_exceeds_limit', { maxSize: formatFileSize(maxSize) })
|
||||
});
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ const FileSelector = ({
|
||||
let isErr = files.some((item) => item.type === '');
|
||||
if (isErr) {
|
||||
return toast({
|
||||
title: fileT('upload error description'),
|
||||
title: fileT('upload_error_description'),
|
||||
status: 'error'
|
||||
});
|
||||
}
|
||||
@@ -245,7 +245,7 @@ const FileSelector = ({
|
||||
);
|
||||
} else {
|
||||
return toast({
|
||||
title: fileT('upload error description'),
|
||||
title: fileT('upload_error_description'),
|
||||
status: 'error'
|
||||
});
|
||||
}
|
||||
@@ -293,18 +293,18 @@ const FileSelector = ({
|
||||
<>
|
||||
<Box fontWeight={'bold'}>
|
||||
{isDragging
|
||||
? fileT('Release the mouse to upload the file')
|
||||
: fileT('Select and drag file tip')}
|
||||
? fileT('release_the_mouse_to_upload_the_file')
|
||||
: fileT('select_and_drag_file_tip')}
|
||||
</Box>
|
||||
{/* file type */}
|
||||
<Box color={'myGray.500'} fontSize={'xs'}>
|
||||
{fileT('Support file type', { fileType })}
|
||||
{fileT('support_file_type', { fileType })}
|
||||
</Box>
|
||||
<Box color={'myGray.500'} fontSize={'xs'}>
|
||||
{/* max count */}
|
||||
{maxCount && fileT('Support max count', { maxCount })}
|
||||
{maxCount && fileT('support_max_count', { maxCount })}
|
||||
{/* max size */}
|
||||
{maxSize && fileT('Support max size', { maxSize: formatFileSize(maxSize) })}
|
||||
{maxSize && fileT('support_max_size', { maxSize: formatFileSize(maxSize) })}
|
||||
</Box>
|
||||
|
||||
<File
|
||||
|
@@ -40,13 +40,13 @@ export const RenderUploadFiles = ({
|
||||
<Thead draggable={false}>
|
||||
<Tr bg={'myGray.100'} mb={2}>
|
||||
<Th borderLeftRadius={'md'} borderBottom={'none'} py={4}>
|
||||
{fileT('File Name')}
|
||||
{fileT('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')}
|
||||
{fileT('file_size')}
|
||||
</Th>
|
||||
<Th borderRightRadius={'md'} borderBottom={'none'} py={4}>
|
||||
{t('common:common.Action')}
|
||||
|
@@ -93,8 +93,8 @@ const CustomLinkInput = () => {
|
||||
<Table bg={'white'}>
|
||||
<Thead>
|
||||
<Tr bg={'myGray.50'}>
|
||||
<Th>{datasetT('External url')}</Th>
|
||||
<Th>{datasetT('External id')}</Th>
|
||||
<Th>{datasetT('external_url')}</Th>
|
||||
<Th>{datasetT('external_id')}</Th>
|
||||
<Th>{datasetT('filename')}</Th>
|
||||
<Th></Th>
|
||||
</Tr>
|
||||
|
@@ -66,7 +66,7 @@ const Info = ({ datasetId }: { datasetId: string }) => {
|
||||
});
|
||||
const { openConfirm: onOpenConfirmRebuild, ConfirmModal: ConfirmRebuildModal } = useConfirm({
|
||||
title: t('common:common.confirm.Common Tip'),
|
||||
content: datasetT('Confirm to rebuild embedding tip'),
|
||||
content: datasetT('confirm_to_rebuild_embedding_tip'),
|
||||
type: 'delete'
|
||||
});
|
||||
|
||||
@@ -128,7 +128,7 @@ const Info = ({ datasetId }: { datasetId: string }) => {
|
||||
refetchDatasetTraining();
|
||||
loadDatasetDetail(datasetId);
|
||||
},
|
||||
successToast: datasetT('Rebuild embedding start tip'),
|
||||
successToast: datasetT('rebuild_embedding_start_tip'),
|
||||
errorToast: t('common:common.Update Failed')
|
||||
});
|
||||
|
||||
@@ -152,7 +152,7 @@ const Info = ({ datasetId }: { datasetId: string }) => {
|
||||
value={vectorModel.model}
|
||||
disableTip={
|
||||
rebuildingCount > 0 || trainingCount > 0
|
||||
? datasetT('The knowledge base has indexes that are being trained or being rebuilt')
|
||||
? datasetT('the_knowledge_base_has_indexes_that_are_being_trained_or_being_rebuilt')
|
||||
: undefined
|
||||
}
|
||||
list={vectorModelList.map((item) => ({
|
||||
@@ -209,8 +209,8 @@ const Info = ({ datasetId }: { datasetId: string }) => {
|
||||
gap={1}
|
||||
alignItems={'center'}
|
||||
>
|
||||
<Box>{datasetT('External read url')}</Box>
|
||||
<QuestionTip label={datasetT('External read url tip')} />
|
||||
<Box>{datasetT('external_read_url')}</Box>
|
||||
<QuestionTip label={datasetT('external_read_url_tip')} />
|
||||
</FormLabel>
|
||||
<Input
|
||||
flex={[1, '0 0 320px']}
|
||||
|
@@ -92,7 +92,7 @@ const Slider = ({ currentTab }: { currentTab: TabEnum }) => {
|
||||
{rebuildingCount > 0 && (
|
||||
<Box mb={3}>
|
||||
<Box fontSize={'sm'}>
|
||||
{datasetT('Rebuilding index count', { count: rebuildingCount })}
|
||||
{datasetT('rebuilding_index_count', { count: rebuildingCount })}
|
||||
</Box>
|
||||
</Box>
|
||||
)}
|
||||
|
@@ -125,22 +125,22 @@ const CreateModal = ({ onClose, parentId }: { onClose: () => void; parentId?: st
|
||||
gridTemplateColumns={'repeat(1,1fr)'}
|
||||
list={[
|
||||
{
|
||||
title: datasetT('Common Dataset'),
|
||||
title: datasetT('common_dataset'),
|
||||
value: DatasetTypeEnum.dataset,
|
||||
icon: 'core/dataset/commonDataset',
|
||||
desc: datasetT('Common Dataset Desc')
|
||||
desc: datasetT('common_dataset_desc')
|
||||
},
|
||||
{
|
||||
title: datasetT('Website Dataset'),
|
||||
title: datasetT('website_dataset'),
|
||||
value: DatasetTypeEnum.websiteDataset,
|
||||
icon: 'core/dataset/websiteDataset',
|
||||
desc: datasetT('Website Dataset Desc')
|
||||
desc: datasetT('website_dataset_desc')
|
||||
},
|
||||
{
|
||||
title: datasetT('External File'),
|
||||
title: datasetT('external_file'),
|
||||
value: DatasetTypeEnum.externalFile,
|
||||
icon: 'core/dataset/externalDataset',
|
||||
desc: datasetT('External file Dataset Desc')
|
||||
desc: datasetT('external_file_dataset_desc')
|
||||
}
|
||||
]}
|
||||
value={datasetType}
|
||||
|
Reference in New Issue
Block a user