From 76caebdd8a55590b06ff080a7c212280fa0d891e Mon Sep 17 00:00:00 2001 From: Tom Najdek Date: Mon, 1 Jul 2024 11:08:41 +0200 Subject: [PATCH] Show current locale in error message in localize-ftl. Fix #4302 --- js-build/localize-ftl.mjs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/js-build/localize-ftl.mjs b/js-build/localize-ftl.mjs index 7146d9b127..8d602e0d86 100644 --- a/js-build/localize-ftl.mjs +++ b/js-build/localize-ftl.mjs @@ -75,11 +75,17 @@ async function getFTL() { } } - const ftl = JSONToFtl(Object.fromEntries(translated), baseFTL); - const outFtlPath = join(getLocaleDir(locale), sourceFileBaseName + '.ftl'); - await fs.outputFile(outFtlPath, ftl); - onProgress(`${locale}/${sourceFileBaseName}.ftl`, null, 'localize'); - count++; + try { + const ftl = JSONToFtl(Object.fromEntries(translated), baseFTL); + const outFtlPath = join(getLocaleDir(locale), sourceFileBaseName + '.ftl'); + await fs.outputFile(outFtlPath, ftl); + onProgress(`${locale}/${sourceFileBaseName}.ftl`, null, 'localize'); + count++; + } + catch (e) { + e.message = `Failed to localize "${locale}": ${e.message}`; + throw e; + } } }