mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-02 10:29:02 +08:00
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:
parent
112d735659
commit
5efce861a9
@ -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',
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user