diff --git a/web/src/assets/svg/baidu-fanyi.svg b/web/src/assets/svg/baidu-fanyi.svg new file mode 100644 index 000000000..d2a34f6e9 --- /dev/null +++ b/web/src/assets/svg/baidu-fanyi.svg @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index 33f641cb9..93d5002a8 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -670,6 +670,61 @@ The above is the content you need to summarize.`, gitHub: 'GitHub', githubDescription: 'This component is used to search the repository from https://github.com/. Top N specifies the number of search results to be adjusted.', + baiduFanyi: 'BaiduFanyi', + baiduFanyiDescription: + 'This component is used to get translations from https://fanyi.baidu.com/. Typically, it provides a more specialized translation result', + appid: 'App id', + secretKey: 'Secret key', + domain: 'Domain', + transType: 'Translation type', + baiduSecretKeyOptions: { + translate: 'General translation', + fieldtranslate: 'Field translation', + }, + baiduDomainOptions: { + it: 'Information technology', + finance: 'Financial and economics', + machinery: 'Machinery manufacturing', + senimed: 'Biomedicine', + novel: 'Online literature', + academic: 'Academic paper', + aerospace: 'Aerospace', + wiki: 'Humanities and social sciences', + news: 'News and information', + law: 'Laws and regulations', + contract: 'Contract', + }, + baiduSourceLangOptions: { + auto: 'Auto detect', + zh: 'Chinese', + en: 'English', + yue: 'Cantonese', + wyw: 'Classical Chinese', + jp: 'Japanese', + kor: 'Korean', + fra: 'French', + spa: 'Spanish', + th: 'Thai', + ara: 'Arabic', + ru: 'Russian', + pt: 'Portuguese', + de: 'German', + it: 'Italian', + el: 'Greek', + nl: 'Dutch', + pl: 'Polish', + bul: 'Bulgarian', + est: 'Estonian', + dan: 'Danish', + fin: 'Finnish', + cs: 'Czech', + rom: 'Romanian', + slo: 'Slovenian', + swe: 'Swedish', + hu: 'Hungarian', + cht: 'Traditional Chinese', + vie: 'Vietnamese', + }, }, footer: { profile: 'All rights reserved @ React', diff --git a/web/src/locales/zh-traditional.ts b/web/src/locales/zh-traditional.ts index 4efdbf6ad..2096a8dea 100644 --- a/web/src/locales/zh-traditional.ts +++ b/web/src/locales/zh-traditional.ts @@ -628,6 +628,61 @@ export default { gitHub: 'GitHub', gitHubDescription: '此元件用於從 https://github.com/ 搜尋儲存庫。 Top N 指定要調整的搜尋結果的數量。', + baiduFanyi: '百度翻譯', + baiduFanyiDescription: + '此組件用於從https://fanyi.baidu.com/取得翻譯。通常,它提供更專業的翻譯結果', + appid: 'App id', + secretKey: '秘鑰', + domain: '領域', + transType: '翻譯類型', + baiduSecretKeyOptions: { + translate: '一般翻譯', + fieldtranslate: '領域翻譯', + }, + baiduDomainOptions: { + it: '資訊科技領域', + finance: '金融財經領域', + machinery: '機械製造領域', + senimed: '生物醫藥領域', + novel: '網路文學領域', + academic: '學術論文領域', + aerospace: '航空航太領域', + wiki: '人文社科領域', + news: '新聞資訊領域', + law: '法律法規領域', + contract: '合約領域', + }, + baiduSourceLangOptions: { + auto: '自動偵測', + zh: '中文', + en: '英語', + yue: '粵語', + wyw: '文言文', + jp: '日文', + kor: '韓文', + fra: '法文', + spa: '西班牙文', + th: '泰語', + ara: '阿拉伯語', + ru: '俄文', + pt: '葡萄牙語', + de: '德語', + it: '義大利語', + el: '希臘文', + nl: '荷蘭語', + pl: '波蘭語', + bul: '保加利亞語', + est: '愛沙尼亞語', + dan: '丹麥語', + fin: '芬蘭語', + cs: '捷克語', + rom: '羅馬尼亞語', + slo: '斯洛維尼亞語', + swe: '瑞典語', + hu: '匈牙利語', + cht: '繁體中文', + vie: '越南語', + }, }, footer: { profile: '“保留所有權利 @ react”', diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts index 87f3eca33..dfdc378ea 100644 --- a/web/src/locales/zh.ts +++ b/web/src/locales/zh.ts @@ -646,6 +646,61 @@ export default { gitHub: 'GitHub', githubDescription: '该组件用于从 https://github.com/ 搜索仓库。Top N 指定需要调整的搜索结果数量。', + baiduFanyi: '百度翻译', + baiduFanyiDescription: + '该组件用于从 https://fanyi.baidu.com/ 获取翻译。通常,它提供更专业的翻译结果', + appid: 'App id', + secretKey: '秘钥', + domain: '领域', + transType: '翻译类型', + baiduSecretKeyOptions: { + translate: '通用翻译', + fieldtranslate: '领域翻译', + }, + baiduDomainOptions: { + it: '信息技术领域', + finance: '金融财经领域', + machinery: '机械制造领域', + senimed: '生物医药领域', + novel: '网络文学领域', + academic: '学术论文领域', + aerospace: '航空航天领域', + wiki: '人文社科领域', + news: '新闻资讯领域', + law: '法律法规领域', + contract: '合同领域', + }, + baiduSourceLangOptions: { + auto: '自动检测', + zh: '中文', + en: '英语', + yue: '粤语', + wyw: '文言文', + jp: '日语', + kor: '韩语', + fra: '法语', + spa: '西班牙语', + th: '泰语', + ara: '阿拉伯语', + ru: '俄语', + pt: '葡萄牙语', + de: '德语', + it: '意大利语', + el: '希腊语', + nl: '荷兰语', + pl: '波兰语', + bul: '保加利亚语', + est: '爱沙尼亚语', + dan: '丹麦语', + fin: '芬兰语', + cs: '捷克语', + rom: '罗马尼亚语', + slo: '斯洛文尼亚语', + swe: '瑞典语', + hu: '匈牙利语', + cht: '繁体中文', + vie: '越南语', + }, }, footer: { profile: 'All rights reserved @ React', diff --git a/web/src/pages/flow/baidu-fanyi-form/index.tsx b/web/src/pages/flow/baidu-fanyi-form/index.tsx new file mode 100644 index 000000000..2148c0bc8 --- /dev/null +++ b/web/src/pages/flow/baidu-fanyi-form/index.tsx @@ -0,0 +1,70 @@ +import { useTranslate } from '@/hooks/common-hooks'; +import { Form, Input, Select } from 'antd'; +import { useMemo } from 'react'; +import { + BaiduFanyiDomainOptions, + BaiduFanyiSourceLangOptions, +} from '../constant'; +import { IOperatorForm } from '../interface'; + +const BaiduFanyiForm = ({ onValuesChange, form }: IOperatorForm) => { + const { t } = useTranslate('flow'); + const options = useMemo(() => { + return ['translate', 'fieldtranslate'].map((x) => ({ + value: x, + label: t(`baiduSecretKeyOptions.${x}`), + })); + }, [t]); + + const baiduFanyiOptions = useMemo(() => { + return BaiduFanyiDomainOptions.map((x) => ({ + value: x, + label: t(`baiduDomainOptions.${x}`), + })); + }, [t]); + + const baiduFanyiSourceLangOptions = useMemo(() => { + return BaiduFanyiSourceLangOptions.map((x) => ({ + value: x, + label: t(`baiduSourceLangOptions.${x}`), + })); + }, [t]); + + return ( +