From a19c8b9106ffbb95b40396d5da5a3c4299311093 Mon Sep 17 00:00:00 2001 From: archer <545436317@qq.com> Date: Fri, 4 Aug 2023 18:26:54 +0800 Subject: [PATCH] i18n --- client/public/locales/en/common.json | 4 ++-- client/public/locales/zh/common.json | 4 ++-- client/src/pages/kb/detail/components/Import/Chunk.tsx | 3 +-- client/src/pages/kb/detail/components/Import/Csv.tsx | 8 +++++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/client/public/locales/en/common.json b/client/public/locales/en/common.json index 9adb16650..2d71149ec 100644 --- a/client/public/locales/en/common.json +++ b/client/public/locales/en/common.json @@ -35,7 +35,7 @@ "select a document": "select a document", "support": "support {{fileExtension}} file", "upload error description": "Only upload multiple files or one folder at a time", - "If the imported file is garbled, please convert CSV to utf-8 encoding format": "If the imported file is garbled, please convert CSV to utf-8 encoding format" + "If the imported file is garbled, please convert CSV to UTF-8 encoding format": "If the imported file is garbled, please convert CSV to UTF-8 encoding format" }, "home": { "Quickly build AI question and answer library": "Quickly build AI question and answer library", @@ -75,4 +75,4 @@ "Update password succseful": "Update password succseful", "Usage Record": "Usage" } -} \ No newline at end of file +} diff --git a/client/public/locales/zh/common.json b/client/public/locales/zh/common.json index 5aa0cea43..b7135f264 100644 --- a/client/public/locales/zh/common.json +++ b/client/public/locales/zh/common.json @@ -35,7 +35,7 @@ "select a document": "选择文件", "support": "支持 {{fileExtension}} 文件", "upload error description": "单次只支持上传多个文件或者一个文件夹", - "If the imported file is garbled, please convert CSV to utf-8 encoding format": "如果导入文件乱码,请将 CSV 转成 utf-8 编码格式" + "If the imported file is garbled, please convert CSV to UTF-8 encoding format": "如果导入文件乱码,请将 CSV 转成 UTF-8 编码格式" }, "home": { "Quickly build AI question and answer library": "快速搭建 AI 问答系统", @@ -75,4 +75,4 @@ "Update password succseful": "修改密码成功", "Usage Record": "使用记录" } -} \ No newline at end of file +} diff --git a/client/src/pages/kb/detail/components/Import/Chunk.tsx b/client/src/pages/kb/detail/components/Import/Chunk.tsx index 6b70473de..4fd72abcd 100644 --- a/client/src/pages/kb/detail/components/Import/Chunk.tsx +++ b/client/src/pages/kb/detail/components/Import/Chunk.tsx @@ -9,8 +9,7 @@ import { NumberInputStepper, NumberIncrementStepper, NumberDecrementStepper, - Image, - Textarea + Image } from '@chakra-ui/react'; import { useToast } from '@/hooks/useToast'; import { useConfirm } from '@/hooks/useConfirm'; diff --git a/client/src/pages/kb/detail/components/Import/Csv.tsx b/client/src/pages/kb/detail/components/Import/Csv.tsx index 96d12372a..3de222b70 100644 --- a/client/src/pages/kb/detail/components/Import/Csv.tsx +++ b/client/src/pages/kb/detail/components/Import/Csv.tsx @@ -52,7 +52,7 @@ const CsvImport = ({ kbId }: { kbId: string }) => { promise = promise.then(async () => { const { header, data } = await readCsvContent(file); if (header[0] !== 'question' || header[1] !== 'answer') { - throw new Error('csv 文件格式有误'); + throw new Error('csv 文件格式有误,请确保 question 和 answer 两列'); } setFiles((state) => [ @@ -73,7 +73,7 @@ const CsvImport = ({ kbId }: { kbId: string }) => { } catch (error: any) { console.log(error); toast({ - title: typeof error === 'string' ? error : '解析文件失败', + title: getErrText(error, '解析文件失败'), status: 'error' }); } @@ -136,7 +136,9 @@ const CsvImport = ({ kbId }: { kbId: string }) => { fileExtension={fileExtension} onSelectFile={onSelectFile} isLoading={selecting} - tipText={'If the imported file is garbled, please convert CSV to utf-8 encoding format'} + tipText={ + 'file.If the imported file is garbled, please convert CSV to UTF-8 encoding format' + } py={emptyFiles ? '100px' : 5} isCsv />