diff options
Diffstat (limited to 'src/app')
-rw-r--r-- | src/app/index.html | 15 | ||||
-rw-r--r-- | src/app/lang.js | 10 | ||||
-rw-r--r-- | src/app/main.js | 7 |
3 files changed, 24 insertions, 8 deletions
diff --git a/src/app/index.html b/src/app/index.html index 67d2e5c..1c34360 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -6,22 +6,23 @@ <body> <div class="lines"> <div class="line"> - <div class="text">Welcome to Viper!</div> + <div class="text">%%gui.welcome%%</div> <div class="buttons"> - <button id="exit" onclick="exit()">Exit</button> - <button id="update" onclick="update()">Update</button> - <button id="setpath" onclick="setpath()">Game Path</button> + <button id="exit" onclick="exit()">%%gui.exit%%</button> + <button id="update" onclick="update()">%%gui.update%%</button> + <button id="setpath" onclick="setpath()">%%gui.setpath%%</button> </div> </div> <div class="line"> - <div class="text">Launch:</div> + <div class="text">%%gui.launch%%:</div> <div class="buttons"> - <button id="vanilla" onclick="launchVanilla()">Vanilla</button> - <button id="northstar" onclick="launch()">Northstar</button> + <button id="vanilla" onclick="launchVanilla()">%%gui.launchvanilla%%</button> + <button id="northstar" onclick="launch()">%%gui.launchnorthstar%%</button> </div> </div> </div> <script src="main.js"></script> + <script src="lang.js"></script> </body> </html> diff --git a/src/app/lang.js b/src/app/lang.js new file mode 100644 index 0000000..8cf3d4b --- /dev/null +++ b/src/app/lang.js @@ -0,0 +1,10 @@ +html = document.body.innerHTML.split("%%"); + +for (let i = 0; i < html.length; i++) { + if (html[i][0] != " " && + html[i][html[i].length - 1] != " ") { + html[i] = lang(html[i]) + } +} + +document.body.innerHTML = html.join(""); diff --git a/src/app/main.js b/src/app/main.js index d390962..579f785 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -2,20 +2,25 @@ const fs = require("fs"); const path = require("path"); const { ipcRenderer } = require("electron"); +const lang = require("../lang"); + var settings = { gamepath: "", zip: "/northstar.zip", + lang: navigator.language, excludes: [ "ns_startup_args.txt", "ns_startup_args_dedi.txt" ] } +ipcRenderer.send("setlang", settings.lang); + if (fs.existsSync("viper.json")) { settings = {...settings, ...JSON.parse(fs.readFileSync("viper.json", "utf8"))}; settings.zip = path.join(settings.gamepath + "/northstar.zip"); } else { - alert("Game path is not set! Please select the path!"); + alert(lang("gui.missinggamepath")); setpath(); } |