diff options
author | Alystrasz <contact@remyraes.com> | 2022-01-08 15:00:38 +0100 |
---|---|---|
committer | Alystrasz <contact@remyraes.com> | 2022-02-19 22:35:04 +0100 |
commit | 17947210b3fc9bac6ea2219655c73af07113690e (patch) | |
tree | d714ce2fd5174e8b5e8d27ae249a7023b4c74d25 | |
parent | 83469ae18e04c3e812c32c4e6a8dc10c9f74ee54 (diff) | |
download | Viper-17947210b3fc9bac6ea2219655c73af07113690e.tar.gz Viper-17947210b3fc9bac6ea2219655c73af07113690e.zip |
[fix] translation file is only loaded is current context didn't set up lang variable
-rw-r--r-- | src/lang.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lang.js b/src/lang.js index 3e0ca42..8174174 100644 --- a/src/lang.js +++ b/src/lang.js @@ -1,7 +1,7 @@ const fs = require("fs"); const enLang = JSON.parse(fs.readFileSync(__dirname + `/lang/en.json`, "utf8")); -let lang = "en"; +let lang = ""; var langObj = {}; @@ -16,13 +16,16 @@ function _loadTranslation() { lang = "en"; } } + } else { + lang = "en"; } langObj = JSON.parse(fs.readFileSync(__dirname + `/lang/${lang}.json`, "utf8")); } module.exports = (string) => { - _loadTranslation(); + if (lang === "") + _loadTranslation(); if (langObj[string]) { return langObj[string]; |