From c7d3e7480395fa7e5cb0104c8c8efd87ecb6a1a4 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Tue, 28 Dec 2021 18:03:06 +0100 Subject: attempt at making localization This may or may not be how we actually do localization in the future, however for now this seems doable. I will obviously need to look at how we detect the language, as I think instead of relying on names like "en-US" just have "en", so we don't have to symlink various editions of English to the same file. But for now this is a draft, and the important part of this is rather how the underlying localization works. --- src/cli.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/cli.js') diff --git a/src/cli.js b/src/cli.js index e5fe042..8593117 100644 --- a/src/cli.js +++ b/src/cli.js @@ -5,6 +5,7 @@ const Emitter = require("events"); const events = new Emitter(); const cli = app.commandLine; +const lang = require("./lang"); function hasArgs() { if (cli.hasSwitch("cli") || @@ -24,12 +25,12 @@ function exit(code) { async function init() { if (cli.hasSwitch("help")) { console.log(`options: - --help shows this help message - --debug opens the dev/debug tools + --help ${lang("cli.help.help")} + --debug ${lang("cli.help.debug")} - --cli forces the CLI to enable - --update updates Northstar from your set game path - --setpath sets your game path`) + --cli ${lang("cli.help.cli")} + --update ${lang("cli.help.update")} + --setpath ${lang("cli.help.setpath")}`) // In the future --setpath should be able to understand // relative paths, instead of just absolute ones. exit(); @@ -43,7 +44,8 @@ async function init() { if (cli.getSwitchValue("setpath") != "") { ipcMain.emit("setpathcli", cli.getSwitchValue("setpath")); } else { - console.error("error: No argumment provided for --setpath"); + console.error(`error: ${lang("cli.setpath.noarg")}`); + exit(1); } } -- cgit v1.2.3