diff --git a/scripts/update-i18n.ts b/scripts/update-i18n.ts index ac05dce2..2140f4ce 100644 --- a/scripts/update-i18n.ts +++ b/scripts/update-i18n.ts @@ -46,7 +46,7 @@ async function translate(zh: object, obj: object, target: string, model: string, { role: 'user', content: ` -You are a robot specifically designed for translation tasks. As a model that has been extensively fine-tuned on Russian language corpora, you are proficient in using the Russian language. +You are a robot specifically designed for translation tasks. As a model that has been extensively fine-tuned on Russian language corpora, you are proficient in using the Russian language. Now, please output the translation based on the input content. The input will include both Chinese and English key values, and you should output the corresponding key values in the Russian language. When translating, ensure that no key value is omitted, and maintain the accuracy and fluency of the translation. Pay attention to the capitalization rules in the output to match the source text, and especially pay attention to whether to capitalize the first letter of each word except for prepositions. For strings containing \`{{value}}\`, ensure that the format is not disrupted. Output in JSON. @@ -76,7 +76,7 @@ MAKE SURE TO OUTPUT IN Russian. DO NOT OUTPUT IN UNSPECIFIED LANGUAGE. { role: 'user', content: ` -You are a robot specifically designed for translation tasks. As a model that has been extensively fine-tuned on ${target} language corpora, you are proficient in using the ${target} language. +You are a robot specifically designed for translation tasks. As a model that has been extensively fine-tuned on ${target} language corpora, you are proficient in using the ${target} language. Now, please output the translation based on the input content. The input will include both Chinese and English key values, and you should output the corresponding key values in the ${target} language. When translating, ensure that no key value is omitted, and maintain the accuracy and fluency of the translation. Pay attention to the capitalization rules in the output to match the source text, and especially pay attention to whether to capitalize the first letter of each word except for prepositions. For strings containing \`{{value}}\`, ensure that the format is not disrupted. Output in JSON. @@ -120,11 +120,11 @@ MAKE SURE TO OUTPUT IN ${target}. DO NOT OUTPUT IN UNSPECIFIED LANGUAGE. ;(async () => { for (const { name, code, model } of INDEX) { - const obj = fs.existsSync(`src/renderer/src/i18n/locales/${code}.json`) - ? JSON.parse(fs.readFileSync(`src/renderer/src/i18n/locales/${code}.json`, 'utf8')) + const obj = fs.existsSync(`src/renderer/src/i18n/translate/${code}.json`) + ? JSON.parse(fs.readFileSync(`src/renderer/src/i18n/translate/${code}.json`, 'utf8')) : {} await translate(zh, obj, name, model, () => { - fs.writeFileSync(`src/renderer/src/i18n/locales/${code}.json`, JSON.stringify(obj, null, 4), 'utf8') + fs.writeFileSync(`src/renderer/src/i18n/translate/${code}.json`, JSON.stringify(obj, null, 2), 'utf8') }) } })() diff --git a/src/renderer/src/i18n/index.ts b/src/renderer/src/i18n/index.ts index df438f8d..ff4dda95 100644 --- a/src/renderer/src/i18n/index.ts +++ b/src/renderer/src/i18n/index.ts @@ -1,15 +1,17 @@ import i18n from 'i18next' import { initReactI18next } from 'react-i18next' -import elGR from './locales/el-gr.json' +// Original translation import enUS from './locales/en-us.json' -import esES from './locales/es-es.json' -import frFR from './locales/fr-fr.json' import jaJP from './locales/ja-jp.json' -import ptPT from './locales/pt-pt.json' import ruRU from './locales/ru-ru.json' import zhCN from './locales/zh-cn.json' import zhTW from './locales/zh-tw.json' +// Machine translation +import elGR from './translate/el-gr.json' +import esES from './translate/es-es.json' +import frFR from './translate/fr-fr.json' +import ptPT from './translate/pt-pt.json' const resources = { 'el-GR': elGR, diff --git a/src/renderer/src/i18n/translate/README.md b/src/renderer/src/i18n/translate/README.md new file mode 100644 index 00000000..abdaacb0 --- /dev/null +++ b/src/renderer/src/i18n/translate/README.md @@ -0,0 +1,2 @@ +本目录文件使用机器翻译,请勿编辑 +This directory file is machine translated, please do not edit diff --git a/src/renderer/src/i18n/locales/el-gr.json b/src/renderer/src/i18n/translate/el-gr.json similarity index 100% rename from src/renderer/src/i18n/locales/el-gr.json rename to src/renderer/src/i18n/translate/el-gr.json diff --git a/src/renderer/src/i18n/locales/es-es.json b/src/renderer/src/i18n/translate/es-es.json similarity index 100% rename from src/renderer/src/i18n/locales/es-es.json rename to src/renderer/src/i18n/translate/es-es.json diff --git a/src/renderer/src/i18n/locales/fr-fr.json b/src/renderer/src/i18n/translate/fr-fr.json similarity index 100% rename from src/renderer/src/i18n/locales/fr-fr.json rename to src/renderer/src/i18n/translate/fr-fr.json diff --git a/src/renderer/src/i18n/locales/pt-pt.json b/src/renderer/src/i18n/translate/pt-pt.json similarity index 100% rename from src/renderer/src/i18n/locales/pt-pt.json rename to src/renderer/src/i18n/translate/pt-pt.json