ci(i18n): update translation config to use TRANSLATION_BASE_LOCALE (#10965)
Change BASE_LOCALE to TRANSLATION_BASE_LOCALE across scripts and workflows for consistency Add console log for base locale in auto-translate script
This commit is contained in:
1
.github/workflows/auto-i18n.yml
vendored
1
.github/workflows/auto-i18n.yml
vendored
@@ -4,6 +4,7 @@ env:
|
||||
TRANSLATION_API_KEY: ${{ secrets.TRANSLATE_API_KEY }}
|
||||
TRANSLATION_MODEL: ${{ vars.AUTO_I18N_MODEL || 'deepseek/deepseek-v3.1'}}
|
||||
TRANSLATION_BASE_URL: ${{ vars.AUTO_I18N_BASE_URL || 'https://api.ppinfra.com/openai'}}
|
||||
TRANSLATION_BASE_LOCALE: ${{ vars.AUTO_I18N_BASE_LOCALE || 'en-us'}}
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
@@ -56,7 +56,7 @@ Performance Optimization Recommendations:
|
||||
- For unstable services: MAX_CONCURRENT_TRANSLATIONS=2, TRANSLATION_DELAY_MS=500
|
||||
|
||||
Environment Variables:
|
||||
- BASE_LOCALE: Base locale for translation (default: 'en-us')
|
||||
- TRANSLATION_BASE_LOCALE: Base locale for translation (default: 'en-us')
|
||||
- TRANSLATION_BASE_URL: Custom API endpoint URL
|
||||
- TRANSLATION_MODEL: Custom translation model name
|
||||
*/
|
||||
@@ -258,7 +258,7 @@ const main = async () => {
|
||||
|
||||
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 baseLocale = process.env.TRANSLATION_BASE_LOCALE ?? 'en-us'
|
||||
const baseFileName = `${baseLocale}.json`
|
||||
const baseLocalePath = path.join(__dirname, '../src/renderer/src/i18n/locales', baseFileName)
|
||||
if (!fs.existsSync(baseLocalePath)) {
|
||||
@@ -284,6 +284,7 @@ const main = async () => {
|
||||
const translateFiles = getFiles(translateDir)
|
||||
const files = [...localeFiles, ...translateFiles]
|
||||
|
||||
console.info(`📂 Base Locale: ${baseLocale}`)
|
||||
console.info('📂 Files to translate:')
|
||||
files.forEach((filePath) => {
|
||||
const filename = path.basename(filePath, '.json')
|
||||
|
||||
@@ -5,7 +5,7 @@ import { sortedObjectByKeys } from './sort'
|
||||
|
||||
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 ?? 'zh-cn'
|
||||
const baseLocale = process.env.TRANSLATION_BASE_LOCALE ?? 'en-us'
|
||||
const baseFileName = `${baseLocale}.json`
|
||||
const baseFilePath = path.join(localesDir, baseFileName)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user