summaryrefslogtreecommitdiffstats
path: root/extra/remove-empty-lang-keys.js
blob: 6b34fa00c967dc58081015b73764c3d5c8c613ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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");
}