From d297676620299c34e88aedbbd487dcd1e59f494b Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Mon, 21 Jun 2021 00:11:23 +0200 Subject: [PATCH] Improvements to error output in translation generation --- scripts/generateTranslations.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/generateTranslations.ts b/scripts/generateTranslations.ts index 9dd9b0b72..263518de2 100644 --- a/scripts/generateTranslations.ts +++ b/scripts/generateTranslations.ts @@ -231,8 +231,7 @@ function MergeTranslation(source: any, target: any, language: string, context: s } if (typeof targetV === "string") { - console.error("Could not add a translation to string ", targetV, ". The translation is", sourceV, " in " + context) - continue; + 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)}` } targetV[language] = sourceV; @@ -261,7 +260,7 @@ function mergeLayerTranslation(layerConfig: { id: string }, path: string, transl const id = layerConfig.id; translationFiles.forEach((translations, lang) => { const translationsForLayer = translations[id] - MergeTranslation(translationsForLayer, layerConfig, lang, id) + MergeTranslation(translationsForLayer, layerConfig, lang, path+":"+id) }) }