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); } })