optionally list missing translations with verify.js

This commit is contained in:
dakkar 2024-06-11 15:29:25 +01:00
parent 566d0aa2bf
commit 50c59889b0

View File

@ -1,5 +1,7 @@
import locales from './index.js';
const showUntranslated = process.argv[2] == '-v';
let valid = true;
function writeError(type, lang, tree, data) {
@ -34,6 +36,10 @@ function verify(expected, actual, lang, trace) {
writeError('missing_parameter', lang, trace ? `${trace}.${key}` : key, { parameter });
}
}
if (showUntranslated && actual[key] == expected[key]) {
writeError('untranslated', lang, trace ? `${trace}.${key}` : key, { original: expected[key] });
}
}
}
}