From fe6dd267136f09bab721d3f02d43b991ac2bad3d Mon Sep 17 00:00:00 2001 From: Alystrasz Date: Tue, 11 Jan 2022 16:40:35 +0100 Subject: [refactor] adding translations for notification texts --- src/lang/en.json | 3 +++ src/lang/fr.json | 3 +++ 2 files changed, 6 insertions(+) (limited to 'src/lang') diff --git a/src/lang/en.json b/src/lang/en.json index 68d46c7..2003bee 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -58,6 +58,9 @@ "gui.update.uptodate": "Already up to date!", "gui.update.available": "A new update for Viper is available, do you want to restart and apply it?", + "gui.nsupdate.gaming.title": "Northstar update available!", + "gui.nsupdate.gaming.body": "An update for Northstar is available.\nYou can force its installation after closing the game.", + "gui.launch": "Launch", "gui.launchvanilla": "Vanilla", "gui.launchnorthstar": "Northstar", diff --git a/src/lang/fr.json b/src/lang/fr.json index 22afa9a..ec4b263 100644 --- a/src/lang/fr.json +++ b/src/lang/fr.json @@ -58,6 +58,9 @@ "gui.update.uptodate": "Déjà à jour !", "gui.update.available": "Une mise à jour pour Viper est disponible, voulez-vous l'installer maintenant ?", + "gui.nsupdate.gaming.title": "Mise à jour Northstar disponible !", + "gui.nsupdate.gaming.body": "Une mise à jour pour Northstar est disponible.\nVous pourrez l'installer après avoir fermé le jeu.", + "gui.launch": "Jouer", "gui.launchvanilla": "Vanilla", "gui.launchnorthstar": "Northstar", -- cgit v1.2.3 From 84c62584f03126bf23b5c2899e05359d7bfc4471 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Tue, 11 Jan 2022 20:06:41 +0100 Subject: formatting, and localized logs --- src/lang/en.json | 6 ++++++ src/utils.js | 22 ++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) (limited to 'src/lang') diff --git a/src/lang/en.json b/src/lang/en.json index 2003bee..bb5cf09 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -19,6 +19,12 @@ "cli.update.finished": "Installation/Update finished!", "cli.update.uptodate": "Latest version (%s) is already installed, skipping update.", + "cli.autoupdates.checking": "Checking for Northstar updates...", + "cli.autoupdates.available": "Northstar update available!", + "cli.autoupdates.gamerunning": "Game is running, refusing to update Northstar", + "cli.autoupdates.updatingns": "Launching update process...", + "cli.autoupdates.noupdate": "No Northstar update available.", + "cli.launch.linuxerror": "Launching the game is not currently supported on Linux", "cli.mods.failed": "Failed to install mod!", diff --git a/src/utils.js b/src/utils.js index 95e54e0..87499ae 100644 --- a/src/utils.js +++ b/src/utils.js @@ -36,7 +36,7 @@ if (fs.existsSync("viper.json")) { } -async function _isGameRunning() { +async function isGameRunning() { return new Promise(resolve => { let procs = ["Titanfall2.exe", "Titanfall2-unpacked.exe", "NorthstarLauncher.exe"]; let cmd = (() => { @@ -60,28 +60,29 @@ async function _isGameRunning() { } northstar_auto_updates: { - if (!settings.autoupdate || !fs.existsSync("viper.json") || settings.gamepath.length === 0) + if (!settings.autoupdate || !fs.existsSync("viper.json") || settings.gamepath.length === 0) { break northstar_auto_updates; + } async function _checkForUpdates() { - const localVersion = getNSVersion(); - const distantVersion = await requests.getLatestNsVersion(); - console.log('Checking for Northstar updates...'); + let localVersion = getNSVersion(); + let distantVersion = await requests.getLatestNsVersion(); + console.log(lang("cli.autoupdates.checking")); if (localVersion !== distantVersion) { - console.log('Northstar update available!'); - if (await _isGameRunning()) { - console.log('Not installing update since game is running.'); + console.log(lang("cli.autoupdates.available")); + if (await isGameRunning()) { + console.log(lang("cli.autoupdates.gamerunning")); new Notification({ title: lang("gui.nsupdate.gaming.title"), body: lang("gui.nsupdate.gaming.body") }).show(); } else { - console.log('Launching update process.'); + console.log(lang("cli.autoupdates.updatingns")); update(); } } else { - console.log('No Northstar update available.') + console.log(lang("cli.autoupdates.noupdate")) } setTimeout( @@ -486,6 +487,7 @@ module.exports = { updatevp, settings, getNSVersion, + isGameRunning, setlang: (lang) => { settings.lang = lang; saveSettings(); -- cgit v1.2.3 From dd2786488c445fdd8bcc62a0ad735a7715f93d57 Mon Sep 17 00:00:00 2001 From: Alystrasz Date: Tue, 11 Jan 2022 23:03:07 +0100 Subject: [feat] adding missing translations --- src/lang/fr.json | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/lang') diff --git a/src/lang/fr.json b/src/lang/fr.json index ec4b263..0eb083c 100644 --- a/src/lang/fr.json +++ b/src/lang/fr.json @@ -19,6 +19,12 @@ "cli.update.finished": "Mise à jour terminée !", "cli.update.uptodate": "La dernière version (%s) est déjà installée.", + "cli.autoupdates.checking": "Vérifications des mises à jour de Northstar...", + "cli.autoupdates.available": "Une mise à jour de Northstar est disponible !", + "cli.autoupdates.gamerunning": "Le jeu est en cours d'exécution, impossible de lancer la mise à jour.", + "cli.autoupdates.updatingns": "Lancement de la mise à jour...", + "cli.autoupdates.noupdate": "Pas de mise à jour de Northstar disponible.", + "cli.launch.linuxerror": "Le support du jeu sur Linux n'est pas encore implémenté.", "cli.mods.failed": "L'installation du mod a échoué.", -- cgit v1.2.3