summaryrefslogtreecommitdiffstats
path: root/extra/remove-empty-lang-keys.js
diff options
context:
space:
mode:
Diffstat (limited to 'extra/remove-empty-lang-keys.js')
-rw-r--r--extra/remove-empty-lang-keys.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/extra/remove-empty-lang-keys.js b/extra/remove-empty-lang-keys.js
new file mode 100644
index 0000000..6b34fa0
--- /dev/null
+++ b/extra/remove-empty-lang-keys.js
@@ -0,0 +1,25 @@
+// For #5231
+
+const fs = require("fs");
+
+let path = "../src/lang";
+
+// list directories in the lang directory
+let jsonFileList = fs.readdirSync(path);
+
+for (let jsonFile of jsonFileList) {
+ if (!jsonFile.endsWith(".json")) {
+ continue;
+ }
+
+ let jsonPath = path + "/" + jsonFile;
+ let langData = JSON.parse(fs.readFileSync(jsonPath, "utf8"));
+
+ for (let key in langData) {
+ if (langData[key] === "") {
+ delete langData[key];
+ }
+ }
+
+ fs.writeFileSync(jsonPath, JSON.stringify(langData, null, 4) + "\n");
+}