fix: some GitHub run action problem (#13991)

This commit is contained in:
Joel 2025-02-19 11:35:19 +08:00 • committed by GitHub
commit 66747a8eef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
151 changed files with 5894 additions and 99 deletions

View file

@ -30,10 +30,15 @@ async function translateMissingKeyDeeply(sourceObj, targetObject, toLanguage) {
}
else {
try {
if (!sourceObj[key]) {
const source = sourceObj[key]
if (!source) {
targetObject[key] = ''
return
}
// not support translate with '(' or ')'
if (source.includes('(') || source.includes(')'))
return
const { translation } = await translate(sourceObj[key], null, languageKeyMap[toLanguage])
targetObject[key] = translation
}
@ -82,7 +87,12 @@ async function main() {
await Promise.all(files.map(async (file) => {
await Promise.all(Object.keys(languageKeyMap).map(async (language) => {
await autoGenTrans(file, language)
try {
await autoGenTrans(file, language)
}
catch (e) {
console.error(`Error translating ${file} to ${language}`, e)
}
}))
}))
}