forked from MapComplete/MapComplete
Improvements to error output in translation generation
This commit is contained in:
parent
65486b6953
commit
d297676620
1 changed files with 2 additions and 3 deletions
|
@ -231,8 +231,7 @@ function MergeTranslation(source: any, target: any, language: string, context: s
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof targetV === "string") {
|
if (typeof targetV === "string") {
|
||||||
console.error("Could not add a translation to string ", targetV, ". The translation is", sourceV, " in " + context)
|
throw `At context ${context}: Could not add a translation. The target object has a string at the given path, whereas the translation contains an object.\n String at target: ${targetV}\n Object at translation source: ${JSON.stringify(sourceV)}`
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
targetV[language] = sourceV;
|
targetV[language] = sourceV;
|
||||||
|
@ -261,7 +260,7 @@ function mergeLayerTranslation(layerConfig: { id: string }, path: string, transl
|
||||||
const id = layerConfig.id;
|
const id = layerConfig.id;
|
||||||
translationFiles.forEach((translations, lang) => {
|
translationFiles.forEach((translations, lang) => {
|
||||||
const translationsForLayer = translations[id]
|
const translationsForLayer = translations[id]
|
||||||
MergeTranslation(translationsForLayer, layerConfig, lang, id)
|
MergeTranslation(translationsForLayer, layerConfig, lang, path+":"+id)
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue