diff options
author | 0neGal <mail@0negal.com> | 2021-12-29 01:15:41 +0100 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2021-12-29 01:17:19 +0100 |
commit | 4abe10aebdfa06c9b9c31c98f084d511e3e2e319 (patch) | |
tree | dd9cc0f644cf22aa6f381978f041e3ca0275b558 /src/utils.js | |
parent | 34cf8cbd3afb57d279f4acfb6f2f891e974137bd (diff) | |
download | Viper-4abe10aebdfa06c9b9c31c98f084d511e3e2e319.tar.gz Viper-4abe10aebdfa06c9b9c31c98f084d511e3e2e319.zip |
cli is now fully localized
That is, it's now using our localization module...
Diffstat (limited to 'src/utils.js')
-rw-r--r-- | src/utils.js | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/utils.js b/src/utils.js index ce927b8..7e9dbac 100644 --- a/src/utils.js +++ b/src/utils.js @@ -6,6 +6,7 @@ const Emitter = require("events"); const events = new Emitter(); const cli = require("./cli"); +const lang = require("./lang"); const unzip = require("unzipper"); const request = require("request"); @@ -28,7 +29,7 @@ if (fs.existsSync("viper.json")) { settings = {...settings, ...JSON.parse(fs.readFileSync("viper.json", "utf8"))}; settings.zip = path.join(settings.gamepath + "/northstar.zip"); } else { - console.log("Game path is not set! Please select the path."); + console.log(lang("gui.missinggamepath")); } function setpath(win) { @@ -70,7 +71,7 @@ function update() { } } - console.log("Checking for updates..."); + console.log(lang("cli.update.checking")); const version = getInstalledVersion(); request({ @@ -81,12 +82,12 @@ function update() { var tag = body["tag_name"]; if (version === tag) { - console.log(`Latest version (${version}) is already installed, skipping update.`); + console.log(lang("cli.update.uptodate"), version); return; } else { if (version != "unknown") { - console.log("Current version:", version); - }; console.log("Downloading:", tag); + console.log(lang("cli.update.current"), version); + }; console.log(lang("cli.update.downloading"), tag); } https.get(body.assets[0].browser_download_url, (res) => { @@ -94,10 +95,10 @@ function update() { res.pipe(stream); stream.on("finish", () => { stream.close(); - console.log("Download done! Extracting..."); + console.log(lang("cli.update.downloaddone")); fs.createReadStream(settings.zip).pipe(unzip.Extract({path: settings.gamepath})) .on("finish", () => { - console.log("Installation/Update finished!"); + console.log(lang("cli.update.finished")); fs.writeFileSync(path.join(settings.gamepath, "ns_version.txt"), tag); @@ -119,18 +120,18 @@ function update() { function launch(version) { if (process.platform == "linux") { - console.error("error: Launching the game is not currently supported on Linux") + console.error("error:", lang("cli.launch.linuxerror")) cli.exit(1); } process.chdir(settings.gamepath); switch(version) { case "vanilla": - console.log("Launching Vanilla...") + console.log(lang("general.launching"), "Vanilla...") exec(path.join(settings.gamepath + "/Titanfall2.exe")) break; default: - console.log("Launching Northstar...") + console.log(lang("general.launching"), "Northstar...") exec(path.join(settings.gamepath + "/NorthstarLauncher.exe")) break; } |