Show current locale in error message in localize-ftl. Fix #4302

This commit is contained in:
Tom Najdek 2024-07-01 11:08:41 +02:00
parent 4866c467dc
commit 76caebdd8a
No known key found for this signature in database
GPG key ID: EEC61A7B4C667D77

View file

@ -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;
}
}
}