summaryrefslogtreecommitdiff
path: root/src/status.js
blob: f09a80c3ecec34947e4b5da641ba4607375b49f9 (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
26
27
28
29
30
splangs = require('./languages.json');

fs = require('fs');
chalk = require('chalk');

console.log("Loading databases...");
dbs = fs.readdirSync("./data");
console.log(dbs.length + "/" + splangs.length + " database(s) registered, support status:");
langs = {}
splangs.forEach((e) => {
    langs[e.code] = false;
})
dbs.forEach(db => {
    if (typeof langs[db.split(".")[0]] != "undefined") {
        langs[db.split(".")[0]] = true;
    } else {
        throw new Error("lang: Invalid language");
    }
})

ent = 0;

splangs.forEach((e) => {
    if (langs[e.code]) {
        console.log(" [" + chalk.green("v") + "] " + e.name + " " + chalk.gray("(" + JSON.parse(fs.readFileSync("./data/" + e.code + ".dat").toString()).a.entries.length + " entries, " + JSON.parse(fs.readFileSync("./data/" + e.code + ".dat").toString()).words.length + " words)"));
        ent = ent + JSON.parse(fs.readFileSync("./data/" + e.code + ".dat").toString()).a.entries.length;
    } else {
        console.log(" [" + chalk.red("x") + "] " + e.name);
    }
})