feat(i18n): add new supported locales and clean up translation script

- Add 8 new locales (de-de, el-gr, es-es, fr-fr, ja-jp, pt-pt, ru-ru)
- Remove unused translate directory references from auto-translate script
This commit is contained in:
icarus 2025-10-23 16:13:22 +08:00
parent 112d735659
commit 5efce861a9
2 changed files with 2 additions and 8 deletions

View File

@ -2,7 +2,7 @@ import { defineConfig } from 'i18next-cli'
/** @see https://github.com/i18next/i18next-cli */
export default defineConfig({
locales: ['en-us', 'zh-cn', 'zh-tw'],
locales: ['en-us', 'zh-cn', 'zh-tw', 'de-de', 'el-gr', 'es-es', 'fr-fr', 'ja-jp', 'pt-pt', 'ru-ru'],
extract: {
input: 'src/renderer/src/**/*.{ts,tsx}',
output: 'src/renderer/src/i18n/locales/{{language}}.json',

View File

@ -9,7 +9,6 @@ import * as fs from 'fs'
import * as path from 'path'
const localesDir = path.join(__dirname, '../src/renderer/src/i18n/locales')
const translateDir = path.join(__dirname, '../src/renderer/src/i18n/translate')
const baseLocale = process.env.BASE_LOCALE ?? 'en-us'
const baseFileName = `${baseLocale}.json`
const baseLocalePath = path.join(__dirname, '../src/renderer/src/i18n/locales', baseFileName)
@ -107,15 +106,10 @@ const main = async () => {
if (!fs.existsSync(baseLocalePath)) {
throw new Error(`${baseLocalePath} not found.`)
}
const localeFiles = fs
const files = fs
.readdirSync(localesDir)
.filter((file) => file.endsWith('.json') && file !== baseFileName)
.map((filename) => path.join(localesDir, filename))
const translateFiles = fs
.readdirSync(translateDir)
.filter((file) => file.endsWith('.json') && file !== baseFileName)
.map((filename) => path.join(translateDir, filename))
const files = [...localeFiles, ...translateFiles]
let count = 0
const bar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic)