]> git.proxmox.com Git - mirror_novnc.git/blobdiff - po/po2js
Process input type submit for translations
[mirror_novnc.git] / po / po2js
index 972f0b2c569503b2b829536588a8d3825fd062ef..15304c9c21dfbcbde41116a4b5a30410b4ea882d 100755 (executable)
--- a/po/po2js
+++ b/po/po2js
@@ -32,25 +32,12 @@ if (opt.argv.length != 2) {
 
 var data = po2json.parseFileSync(opt.argv[0]);
 
-var output =
-"/*\n" +
-" * Translations for " + data[""]["language"] + "\n" +
-" *\n" +
-" * This file was autotomatically generated from " + opt.argv[0] + "\n" +
-" * DO NOT EDIT!\n" +
-" */\n" +
-"\n" +
-"Language = {\n";
+var bodyPart = Object.keys(data).filter((msgid) => msgid !== "").map((msgid) => {
+    if (msgid === "") return;
+    var msgstr = data[msgid][1];
+    return "    " + JSON.stringify(msgid) + ": " + JSON.stringify(msgstr);
+}).join(",\n");
 
-for (msgid in data) {
-  if (msgid === "")
-    continue;
-
-  msgstr = data[msgid][1];
-  output += "    " + JSON.stringify(msgid) + ": " +
-            JSON.stringify(msgstr) + ",\n";
-}
-
-output += "};\n";
+var output = "{\n" + bodyPart + "\n}";
 
 fs.writeFileSync(opt.argv[1], output);