aboutsummaryrefslogtreecommitdiff
path: root/src/lang.js
blob: 4e4e4818161ee0af1a2584296347c8bceb2345b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const fs = require("fs");

var lang = "en-US";
if (fs.existsSync("viper.json")) {
	lang = JSON.parse(fs.readFileSync("viper.json", "utf8")).lang;
	if (! fs.existsSync(__dirname + `/lang/${lang}.json`)) {
		lang = "en-US";
	}
}

var langObj = JSON.parse(fs.readFileSync(__dirname + `/lang/${lang}.json`, "utf8"));

module.exports = (string) => {
	if (langObj[string]) {
		return langObj[string];
	} else {
		return string
	}
}