aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2021-12-29 01:15:41 +0100
committer0neGal <mail@0negal.com>2021-12-29 01:17:19 +0100
commit4abe10aebdfa06c9b9c31c98f084d511e3e2e319 (patch)
treedd9cc0f644cf22aa6f381978f041e3ca0275b558
parent34cf8cbd3afb57d279f4acfb6f2f891e974137bd (diff)
downloadViper-4abe10aebdfa06c9b9c31c98f084d511e3e2e319.tar.gz
Viper-4abe10aebdfa06c9b9c31c98f084d511e3e2e319.zip
cli is now fully localized
That is, it's now using our localization module...
-rw-r--r--src/lang/en.json15
-rw-r--r--src/utils.js21
2 files changed, 25 insertions, 11 deletions
diff --git a/src/lang/en.json b/src/lang/en.json
index 2322369..e88079e 100644
--- a/src/lang/en.json
+++ b/src/lang/en.json
@@ -7,6 +7,14 @@
"cli.setpath.noarg": "No argument provided for --setpath",
+ "cli.update.current": "Current version:",
+ "cli.update.downloading": "Downloading:",
+ "cli.update.checking": "Checking for updates...",
+ "cli.update.downloaddone": "Download done! Extracting...",
+ "cli.update.finished": "Installation/Update finished!",
+ "cli.update.uptodate": "Latest version (%s) is already installed, skipping update.",
+
+ "cli.launch.linuxerror": "Launching the game is not currently supported on Linux",
"gui.welcome": "Welcome to Viper!",
"gui.exit": "Exit",
@@ -17,5 +25,10 @@
"gui.launchvanilla": "Vanilla",
"gui.launchnorthstar": "Northstar",
- "gui.missinggamepath": "Game path is not set! Please select the path!"
+ "gui.selectpath": "Please select the path!",
+ "gui.missinggamepath": "Game path is not set!",
+
+
+ "general.launching": "Launching",
+ "general.missingpath": "Game path is not set!"
}
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;
}