Don't include missing translation in .js

It just adds size and confusion. Instead, omit any lines where no
translation is available.
This commit is contained in:
Pierre Ossman
2024-06-18 14:01:40 +02:00
parent fb1817c99f
commit 1a62eb7d3e
3 changed files with 7 additions and 17 deletions

View File

@@ -32,11 +32,13 @@ if (opt.argv.length != 2) {
const data = po2json.parseFileSync(opt.argv[0]);
const bodyPart = Object.keys(data).filter(msgid => msgid !== "").map((msgid) => {
if (msgid === "") return;
const msgstr = data[msgid][1];
return " " + JSON.stringify(msgid) + ": " + JSON.stringify(msgstr);
}).join(",\n");
const bodyPart = Object.keys(data)
.filter(msgid => msgid !== "")
.filter(msgid => data[msgid][1] !== "")
.map((msgid) => {
const msgstr = data[msgid][1];
return " " + JSON.stringify(msgid) + ": " + JSON.stringify(msgstr);
}).join(",\n");
const output = "{\n" + bodyPart + "\n}";