feat(i18n): add machine translations for Greek, Spanish, French, and Portuguese

- Updated the translation script to output machine-generated translations for Greek, Spanish, French, and Portuguese.
- Adjusted file paths for translation outputs and ensured proper formatting in the translation prompts.
- Added a README file to indicate that the translations are machine-generated and should not be edited.
This commit is contained in:
kangfenmao 2025-03-22 23:41:17 +08:00
parent 17bd66259d
commit f9941a6858
7 changed files with 13 additions and 9 deletions

View File

@ -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')
})
}
})()

View File

@ -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,

View File

@ -0,0 +1,2 @@
本目录文件使用机器翻译,请勿编辑
This directory file is machine translated, please do not edit