fix: auto translate fail (#11286)
This commit is contained in:
parent
e39e776d03
commit
a679079a1d
21 changed files with 499 additions and 3 deletions
|
|
@ -29,9 +29,17 @@ async function translateMissingKeyDeeply(sourceObj, targetObject, toLanguage) {
|
|||
await translateMissingKeyDeeply(sourceObj[key], targetObject[key], toLanguage)
|
||||
}
|
||||
else {
|
||||
const { translation } = await translate(sourceObj[key], null, languageKeyMap[toLanguage])
|
||||
targetObject[key] = translation
|
||||
// console.log(translation)
|
||||
try {
|
||||
if (!sourceObj[key]) {
|
||||
targetObject[key] = ''
|
||||
return
|
||||
}
|
||||
const { translation } = await translate(sourceObj[key], null, languageKeyMap[toLanguage])
|
||||
targetObject[key] = translation
|
||||
}
|
||||
catch (e) {
|
||||
console.error(`Error translating ${sourceObj[key]}(${key}) to ${toLanguage}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (typeof sourceObj[key] === 'object') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue