mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-19 14:41:24 +08:00
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:
parent
8054ed7ad8
commit
d8f1a68e87
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_API_KEY: ${{ secrets.TRANSLATE_API_KEY }}
|
||||||
TRANSLATION_MODEL: ${{ vars.AUTO_I18N_MODEL || 'deepseek/deepseek-v3.1'}}
|
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_URL: ${{ vars.AUTO_I18N_BASE_URL || 'https://api.ppinfra.com/openai'}}
|
||||||
|
TRANSLATION_BASE_LOCALE: ${{ vars.AUTO_I18N_BASE_LOCALE || 'en-us'}}
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|||||||
@ -56,7 +56,7 @@ Performance Optimization Recommendations:
|
|||||||
- For unstable services: MAX_CONCURRENT_TRANSLATIONS=2, TRANSLATION_DELAY_MS=500
|
- For unstable services: MAX_CONCURRENT_TRANSLATIONS=2, TRANSLATION_DELAY_MS=500
|
||||||
|
|
||||||
Environment Variables:
|
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_BASE_URL: Custom API endpoint URL
|
||||||
- TRANSLATION_MODEL: Custom translation model name
|
- TRANSLATION_MODEL: Custom translation model name
|
||||||
*/
|
*/
|
||||||
@ -258,7 +258,7 @@ const main = async () => {
|
|||||||
|
|
||||||
const localesDir = path.join(__dirname, '../src/renderer/src/i18n/locales')
|
const localesDir = path.join(__dirname, '../src/renderer/src/i18n/locales')
|
||||||
const translateDir = path.join(__dirname, '../src/renderer/src/i18n/translate')
|
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 baseFileName = `${baseLocale}.json`
|
||||||
const baseLocalePath = path.join(__dirname, '../src/renderer/src/i18n/locales', baseFileName)
|
const baseLocalePath = path.join(__dirname, '../src/renderer/src/i18n/locales', baseFileName)
|
||||||
if (!fs.existsSync(baseLocalePath)) {
|
if (!fs.existsSync(baseLocalePath)) {
|
||||||
@ -284,6 +284,7 @@ const main = async () => {
|
|||||||
const translateFiles = getFiles(translateDir)
|
const translateFiles = getFiles(translateDir)
|
||||||
const files = [...localeFiles, ...translateFiles]
|
const files = [...localeFiles, ...translateFiles]
|
||||||
|
|
||||||
|
console.info(`📂 Base Locale: ${baseLocale}`)
|
||||||
console.info('📂 Files to translate:')
|
console.info('📂 Files to translate:')
|
||||||
files.forEach((filePath) => {
|
files.forEach((filePath) => {
|
||||||
const filename = path.basename(filePath, '.json')
|
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 localesDir = path.join(__dirname, '../src/renderer/src/i18n/locales')
|
||||||
const translateDir = path.join(__dirname, '../src/renderer/src/i18n/translate')
|
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 baseFileName = `${baseLocale}.json`
|
||||||
const baseFilePath = path.join(localesDir, baseFileName)
|
const baseFilePath = path.join(localesDir, baseFileName)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user