feat: ship Wave 5-6 multi-surface hygiene, optimization, and bug fixes
This commit is contained in:
parent
01ef3293cf
commit
66b6b45ba9
399 changed files with 17828 additions and 11330 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env node
|
||||
// scripts/ci/sync-i18n-locales.mjs
|
||||
// Synchronizes translation keys across all 12 locale files in packages/i18n/src/locales/*.json.
|
||||
// Master key list is the union of ko.json and en.json (ordered by ko.json).
|
||||
// Synchronizes or checks translation keys across all 12 locale files in packages/i18n/src/locales/*.json.
|
||||
// Master key list is ko.json + en.json (all translation strings live in locales/*.json, never hardcoded here).
|
||||
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
|
|
@ -9,79 +9,53 @@ import { fileURLToPath } from 'node:url'
|
|||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const localesDir = path.resolve(__dirname, '../../packages/i18n/src/locales')
|
||||
const LOCALES = ['ko', 'en', 'ja', 'zh', 'zh-TW', 'es', 'fr', 'de', 'pt', 'ru', 'vi', 'th']
|
||||
const checkOnly = process.argv.includes('--check')
|
||||
|
||||
const koPath = path.join(localesDir, 'ko.json')
|
||||
const enPath = path.join(localesDir, 'en.json')
|
||||
|
||||
const ko = JSON.parse(fs.readFileSync(koPath, 'utf8'))
|
||||
const en = JSON.parse(fs.readFileSync(enPath, 'utf8'))
|
||||
|
||||
// GAP-UX-07: Align onboarding.llmModelSize with OllamaGuideModal (gemma4:e4b = ~4.0 GB)
|
||||
ko['onboarding.llmModelSize'] = '크기: 약 4.0GB — 네트워크 속도에 따라 3~10분 소요'
|
||||
en['onboarding.llmModelSize'] = 'Size: ~4.0GB — takes 3–10 min depending on network speed'
|
||||
|
||||
// Missing login.* keys in en.json
|
||||
const enLoginDefaults = {
|
||||
'login.apple': 'Continue with Apple',
|
||||
'login.or': 'or',
|
||||
'login.email': 'Email',
|
||||
'login.password': 'Password',
|
||||
'login.signIn': 'Sign in',
|
||||
'login.noAccount': "Don't have an account?",
|
||||
'login.signUp': 'Sign up',
|
||||
}
|
||||
for (const [k, v] of Object.entries(enLoginDefaults)) {
|
||||
if (!(k in en)) en[k] = v
|
||||
}
|
||||
|
||||
// GAP-LLM-01: Translation target language setting keys
|
||||
const targetLangKo = {
|
||||
'settings.targetLanguage': '번역 대상 언어',
|
||||
'settings.targetLanguage.desc': '번역 후처리와 {{targetLanguage}} 명령어에 쓸 언어입니다.',
|
||||
'settings.targetLanguage.en': '영어 (English)',
|
||||
'settings.targetLanguage.ko': '한국어 (Korean)',
|
||||
'settings.targetLanguage.ja': '일본어 (Japanese)',
|
||||
'settings.targetLanguage.zhCN': '중국어 간체 (Chinese Simplified)',
|
||||
'settings.targetLanguage.zhTW': '중국어 번체 (Chinese Traditional)',
|
||||
'settings.targetLanguage.es': '스페인어 (Spanish)',
|
||||
'settings.targetLanguage.fr': '프랑스어 (French)',
|
||||
'settings.targetLanguage.de': '독일어 (German)',
|
||||
'settings.targetLanguage.pt': '포르투갈어 (Portuguese)',
|
||||
'settings.targetLanguage.vi': '베트남어 (Vietnamese)',
|
||||
'settings.targetLanguage.id': '인도네시아어 (Indonesian)',
|
||||
'settings.targetLanguage.ar': '아랍어 (Arabic)',
|
||||
}
|
||||
|
||||
const targetLangEn = {
|
||||
'settings.targetLanguage': 'Translation target language',
|
||||
'settings.targetLanguage.desc': 'Language used for translation post-processing and {{targetLanguage}} commands.',
|
||||
'settings.targetLanguage.en': 'English',
|
||||
'settings.targetLanguage.ko': 'Korean',
|
||||
'settings.targetLanguage.ja': 'Japanese',
|
||||
'settings.targetLanguage.zhCN': 'Chinese (Simplified)',
|
||||
'settings.targetLanguage.zhTW': 'Chinese (Traditional)',
|
||||
'settings.targetLanguage.es': 'Spanish',
|
||||
'settings.targetLanguage.fr': 'French',
|
||||
'settings.targetLanguage.de': 'German',
|
||||
'settings.targetLanguage.pt': 'Portuguese',
|
||||
'settings.targetLanguage.vi': 'Vietnamese',
|
||||
'settings.targetLanguage.id': 'Indonesian',
|
||||
'settings.targetLanguage.ar': 'Arabic',
|
||||
}
|
||||
|
||||
Object.assign(ko, targetLangKo)
|
||||
Object.assign(en, targetLangEn)
|
||||
|
||||
// Ensure ko and en have identical key sets
|
||||
for (const k of Object.keys(ko)) {
|
||||
if (!(k in en)) {
|
||||
en[k] = ko[k]
|
||||
function readLocale(code) {
|
||||
const filePath = path.join(localesDir, `${code}.json`)
|
||||
return {
|
||||
filePath,
|
||||
data: JSON.parse(fs.readFileSync(filePath, 'utf8')),
|
||||
}
|
||||
}
|
||||
|
||||
const koEntry = readLocale('ko')
|
||||
const enEntry = readLocale('en')
|
||||
const ko = koEntry.data
|
||||
const en = enEntry.data
|
||||
|
||||
if (checkOnly) {
|
||||
const koKeys = Object.keys(ko)
|
||||
const koKeySet = new Set(koKeys)
|
||||
const errors = []
|
||||
|
||||
for (const code of LOCALES) {
|
||||
const { data } = readLocale(code)
|
||||
const keys = Object.keys(data)
|
||||
const missing = koKeys.filter((k) => !(k in data))
|
||||
const extra = keys.filter((k) => !koKeySet.has(k))
|
||||
const empty = koKeys.filter((k) => k in data && (typeof data[k] !== 'string' || data[k].trim().length === 0))
|
||||
|
||||
if (missing.length > 0) errors.push(`${code}.json missing ${missing.length} keys (first: ${missing[0]})`)
|
||||
if (extra.length > 0) errors.push(`${code}.json has ${extra.length} extra keys (first: ${extra[0]})`)
|
||||
if (empty.length > 0) errors.push(`${code}.json has ${empty.length} empty values (first: ${empty[0]})`)
|
||||
}
|
||||
|
||||
if (errors.length > 0) {
|
||||
process.stderr.write(`[i18n-sync] FAILED:\n - ${errors.join('\n - ')}\n`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
process.stdout.write(`[i18n-sync] GREEN (${koKeys.length} keys across ${LOCALES.length} locales)\n`)
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
for (const k of Object.keys(ko)) {
|
||||
if (!(k in en)) en[k] = ko[k]
|
||||
}
|
||||
for (const k of Object.keys(en)) {
|
||||
if (!(k in ko)) {
|
||||
ko[k] = en[k]
|
||||
}
|
||||
if (!(k in ko)) ko[k] = en[k]
|
||||
}
|
||||
|
||||
const masterKeys = Object.keys(ko)
|
||||
|
|
@ -94,19 +68,18 @@ function writeOrderedJson(filePath, obj) {
|
|||
fs.writeFileSync(filePath, JSON.stringify(ordered, null, 2) + '\n', 'utf8')
|
||||
}
|
||||
|
||||
writeOrderedJson(koPath, ko)
|
||||
writeOrderedJson(enPath, en)
|
||||
writeOrderedJson(koEntry.filePath, ko)
|
||||
writeOrderedJson(enEntry.filePath, en)
|
||||
|
||||
const otherLocales = ['ja', 'zh', 'zh-TW', 'es', 'fr', 'de', 'pt', 'ru', 'vi', 'th']
|
||||
for (const loc of otherLocales) {
|
||||
const locPath = path.join(localesDir, `${loc}.json`)
|
||||
const data = JSON.parse(fs.readFileSync(locPath, 'utf8'))
|
||||
for (const loc of LOCALES) {
|
||||
if (loc === 'ko' || loc === 'en') continue
|
||||
const { filePath, data } = readLocale(loc)
|
||||
for (const k of masterKeys) {
|
||||
if (!(k in data) || typeof data[k] !== 'string' || data[k].length === 0) {
|
||||
data[k] = en[k] ?? ko[k]
|
||||
}
|
||||
}
|
||||
writeOrderedJson(locPath, data)
|
||||
writeOrderedJson(filePath, data)
|
||||
}
|
||||
|
||||
console.log(`Synchronized ${masterKeys.length} keys across 12 locales.`)
|
||||
process.stdout.write(`[i18n-sync] Synchronized ${masterKeys.length} keys across ${LOCALES.length} locales.\n`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue