Fix/language support (#2154)

This commit is contained in:
crazywoola
2024-01-24 11:08:11 +08:00
committed by GitHub
parent 00f4e6ec44
commit e58c3ac374
28 changed files with 103 additions and 71 deletions

View File

@@ -9,6 +9,7 @@ import { useContext } from 'use-context-selector'
import { Download02 as DownloadIcon } from '@/app/components/base/icons/src/vender/solid/general'
import { DocForm } from '@/models/datasets'
import I18n from '@/context/i18n'
import { LanguagesSupportedUnderscore, getModelRuntimeSupported } from '@/utils/language'
const CSV_TEMPLATE_QA_EN = [
['question', 'answer'],
@@ -34,17 +35,18 @@ const CSV_TEMPLATE_CN = [
const CSVDownload: FC<{ docForm: DocForm }> = ({ docForm }) => {
const { t } = useTranslation()
const { locale } = useContext(I18n)
const language = getModelRuntimeSupported(locale)
const { CSVDownloader, Type } = useCSVDownloader()
const getTemplate = () => {
if (locale === 'en') {
if (language === LanguagesSupportedUnderscore[1]) {
if (docForm === DocForm.QA)
return CSV_TEMPLATE_QA_EN
return CSV_TEMPLATE_EN
return CSV_TEMPLATE_QA_CN
return CSV_TEMPLATE_CN
}
if (docForm === DocForm.QA)
return CSV_TEMPLATE_QA_CN
return CSV_TEMPLATE_CN
return CSV_TEMPLATE_QA_EN
return CSV_TEMPLATE_EN
}
return (