aboutsummaryrefslogtreecommitdiff
path: root/src/app/settings.js
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2022-04-13 22:38:18 +0200
committer0neGal <mail@0negal.com>2022-04-13 22:39:19 +0200
commitb0e0e919ee5d94a3a0d935018f08d3b0fa603245 (patch)
tree9dafbfd6e01f761323934e813c611fd628a4c1c0 /src/app/settings.js
parent476c421b1ebf594b375ebdc53bb60a30c9a78e3c (diff)
downloadViper-b0e0e919ee5d94a3a0d935018f08d3b0fa603245.tar.gz
Viper-b0e0e919ee5d94a3a0d935018f08d3b0fa603245.zip
the user can now manually select a language
This allows someone to have their system in any language, and then have Viper in a separate language. This is also useful for testing.
Diffstat (limited to 'src/app/settings.js')
-rw-r--r--src/app/settings.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/app/settings.js b/src/app/settings.js
index 902e57b..853cd0b 100644
--- a/src/app/settings.js
+++ b/src/app/settings.js
@@ -58,6 +58,8 @@ var Settings = {
} else {
opts[optName] = input;
}
+ } else if (options[i].querySelector(".actions select")) {
+ opts[optName] = options[i].querySelector(".actions select").value;
} else if (options[i].querySelector(".actions .switch")) {
if (options[i].querySelector(".actions .switch.on")) {
opts[optName] = true;
@@ -74,6 +76,23 @@ var Settings = {
for (let i = 0; i < options.length; i++) {
let optName = options[i].getAttribute("name");
+ if (optName == "forcedlang") {
+ let div = options[i].querySelector("select");
+
+ 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"];
+ if (title) {
+ div.innerHTML += `<option value="${langs[i].replace(/\..*$/, '')}">${title}</option>`
+ }
+
+ }
+
+ div.value = settings.forcedlang;
+ continue;
+ }
+
if (settings[optName] != undefined) {
switch(typeof settings[optName]) {
case "string":