aboutsummaryrefslogtreecommitdiff
path: root/src/app/js
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2023-09-16 01:28:38 +0200
committer0neGal <mail@0negal.com>2023-09-16 01:28:38 +0200
commita91f0d2eac46510c109a4faebf520f68a3456aab (patch)
tree66fffa7ea3d8fd1ce097424602d2c428cb4ce8be /src/app/js
parentba64cef4fd5738e5744814bf67dddbd3865132f1 (diff)
downloadViper-a91f0d2eac46510c109a4faebf520f68a3456aab.tar.gz
Viper-a91f0d2eac46510c109a4faebf520f68a3456aab.zip
lang files can now use objects!
The `lang()` function doesn't change whatsoever, as the lang files are flattened and are therefore identical to the before this commit. I also cleaned up the files, and all the lang files should now all look far more similar in order.
Diffstat (limited to 'src/app/js')
-rw-r--r--src/app/js/settings.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/app/js/settings.js b/src/app/js/settings.js
index 682aa49..69ee7b8 100644
--- a/src/app/js/settings.js
+++ b/src/app/js/settings.js
@@ -67,9 +67,15 @@ var Settings = {
div.innerHTML = "";
let langs = fs.readdirSync(__dirname + "/../lang");
for (let i in langs) {
- title = JSON.parse(fs.readFileSync(__dirname + `/../lang/${langs[i]}`, "utf8"))["lang.title"];
+ let lang_no_extension = langs[i].replace(/\..*$/, "");
+ let title = lang("lang.title", lang_no_extension);
+
+ if (title == "lang.title") {
+ continue;
+ }
+
if (title) {
- div.innerHTML += `<option value="${langs[i].replace(/\..*$/, '')}">${title}</option>`
+ div.innerHTML += `<option value="${lang_no_extension}">${title}</option>`
}
}