diff options
Diffstat (limited to 'src/lang.js')
-rw-r--r-- | src/lang.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lang.js b/src/lang.js index 4e4e481..266fb8b 100644 --- a/src/lang.js +++ b/src/lang.js @@ -1,10 +1,15 @@ const fs = require("fs"); -var lang = "en-US"; +var lang = "en"; if (fs.existsSync("viper.json")) { lang = JSON.parse(fs.readFileSync("viper.json", "utf8")).lang; + if (! lang) {lang = "en"} if (! fs.existsSync(__dirname + `/lang/${lang}.json`)) { - lang = "en-US"; + if (fs.existsSync(__dirname + `/lang/${lang.replace(/-.*$/, "")}.json`)) { + lang = lang.replace(/-.*$/, ""); + } else { + lang = "en"; + } } } |