const fs = require('fs'); const path = require('path'); const enUS = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'src', 'i18n', 'locales', 'enUS.json'), 'utf8')); function fixDeep(obj) { for (const k in obj) { if (typeof obj[k] === 'object' && obj[k] !== null) fixDeep(obj[k]); else if (typeof obj[k] === 'string') { if (obj[k].includes('该套餐由') && obj[k].includes('创建')) { obj[k] = 'Package created by "{creator}", no permission to delete'; } if (obj[k].includes('请先在') && obj[k].includes('诊疗项目')) { obj[k] = 'Please add items in System > Catalog > Treatment Items first'; } if (obj[k].includes('确定要删除套餐') && obj[k].includes('无法恢复')) { obj[k] = 'Delete package "{name}"? Cannot be undone.'; } } } } fixDeep(enUS); fs.writeFileSync(path.join(__dirname, '..', 'src', 'i18n', 'locales', 'enUS.json'), JSON.stringify(enUS, null, 2), 'utf8'); function countChinese(obj) { let c = 0; for (const k in obj) { if (typeof obj[k] === 'object' && obj[k] !== null) c += countChinese(obj[k]); else if (typeof obj[k] === 'string' && /[\u4e00-\u9fff]/.test(obj[k])) c++; } return c; } console.log('Remaining Chinese in enUS:', countChinese(enUS));