From 2267655e99f3424820c26f1909eb74c29f85ddbb Mon Sep 17 00:00:00 2001 From: Nelson Chan <3271800+chakflying@users.noreply.github.com> Date: Wed, 27 Sep 2023 04:53:14 +0800 Subject: [PATCH] Chore: Add remaining server translation keys (#3684) --- server/server.js | 63 ++++++++++++------- .../socket-handlers/api-key-socket-handler.js | 12 ++-- .../socket-handlers/docker-socket-handler.js | 3 +- .../socket-handlers/general-socket-handler.js | 6 +- .../maintenance-socket-handler.js | 18 ++++-- .../socket-handlers/proxy-socket-handler.js | 3 +- .../status-page-socket-handler.js | 3 +- src/lang/en.json | 19 +++++- 8 files changed, 91 insertions(+), 36 deletions(-) diff --git a/server/server.js b/server/server.js index 0772fd72b..12ebaee6f 100644 --- a/server/server.js +++ b/server/server.js @@ -342,7 +342,8 @@ let needSetup = false; callback({ ok: false, - msg: "The user is inactive or deleted.", + msg: "authUserInactiveOrDeleted", + msgi18n: true, }); } } catch (error) { @@ -351,7 +352,8 @@ let needSetup = false; callback({ ok: false, - msg: "Invalid token.", + msg: "authInvalidToken", + msgi18n: true, }); } @@ -427,7 +429,8 @@ let needSetup = false; callback({ ok: false, - msg: "Invalid Token!", + msg: "authInvalidToken", + msgi18n: true, }); } } @@ -437,7 +440,8 @@ let needSetup = false; callback({ ok: false, - msg: "Incorrect username or password.", + msg: "authIncorrectCreds", + msgi18n: true, }); } @@ -493,7 +497,8 @@ let needSetup = false; } else { callback({ ok: false, - msg: "2FA is already enabled.", + msg: "2faAlreadyEnabled", + msgi18n: true, }); } } catch (error) { @@ -523,7 +528,8 @@ let needSetup = false; callback({ ok: true, - msg: "2FA Enabled.", + msg: "2faEnabled", + msgi18n: true, }); } catch (error) { @@ -552,7 +558,8 @@ let needSetup = false; callback({ ok: true, - msg: "2FA Disabled.", + msg: "2faDisabled", + msgi18n: true, }); } catch (error) { @@ -584,7 +591,8 @@ let needSetup = false; } else { callback({ ok: false, - msg: "Invalid Token.", + msg: "authInvalidToken", + msgi18n: true, valid: false, }); } @@ -647,7 +655,8 @@ let needSetup = false; callback({ ok: true, - msg: "Added Successfully.", + msg: "successAdded", + msgi18n: true, }); } catch (e) { @@ -700,7 +709,8 @@ let needSetup = false; callback({ ok: true, - msg: "Added Successfully.", + msg: "successAdded", + msgi18n: true, monitorID: bean.id, }); @@ -937,7 +947,8 @@ let needSetup = false; callback({ ok: true, - msg: "Resumed Successfully.", + msg: "successResumed", + msgi18n: true, }); } catch (e) { @@ -956,7 +967,8 @@ let needSetup = false; callback({ ok: true, - msg: "Paused Successfully.", + msg: "successPaused", + msgi18n: true, }); } catch (e) { @@ -994,7 +1006,8 @@ let needSetup = false; callback({ ok: true, - msg: "Deleted Successfully.", + msg: "successDeleted", + msgi18n: true, }); await server.sendMonitorList(socket); @@ -1056,7 +1069,8 @@ let needSetup = false; if (bean == null) { callback({ ok: false, - msg: "Tag not found", + msg: "tagNotFound", + msgi18n: true, }); return; } @@ -1087,7 +1101,8 @@ let needSetup = false; callback({ ok: true, - msg: "Deleted Successfully.", + msg: "successDeleted", + msgi18n: true, }); } catch (e) { @@ -1110,7 +1125,8 @@ let needSetup = false; callback({ ok: true, - msg: "Added Successfully.", + msg: "successAdded", + msgi18n: true, }); } catch (e) { @@ -1133,7 +1149,8 @@ let needSetup = false; callback({ ok: true, - msg: "Edited Successfully.", + msg: "successEdited", + msgi18n: true, }); } catch (e) { @@ -1156,7 +1173,8 @@ let needSetup = false; callback({ ok: true, - msg: "Deleted Successfully.", + msg: "successDeleted", + msgi18n: true, }); } catch (e) { @@ -1250,7 +1268,8 @@ let needSetup = false; callback({ ok: true, - msg: "Password has been updated successfully.", + msg: "successAuthChangePassword", + msgi18n: true, }); } catch (e) { @@ -1374,7 +1393,8 @@ let needSetup = false; callback({ ok: true, - msg: "Deleted", + msg: "successDeleted", + msgi18n: true, }); } catch (e) { @@ -1609,7 +1629,8 @@ let needSetup = false; callback({ ok: true, - msg: "Backup successfully restored.", + msg: "successBackupRestored", + msgi18n: true, }); } catch (e) { diff --git a/server/socket-handlers/api-key-socket-handler.js b/server/socket-handlers/api-key-socket-handler.js index 8a4f5d440..f76b90991 100644 --- a/server/socket-handlers/api-key-socket-handler.js +++ b/server/socket-handlers/api-key-socket-handler.js @@ -38,7 +38,8 @@ module.exports.apiKeySocketHandler = (socket) => { callback({ ok: true, - msg: "Added Successfully.", + msg: "successAdded", + msgi18n: true, key: formattedKey, keyID: bean.id, }); @@ -82,7 +83,8 @@ module.exports.apiKeySocketHandler = (socket) => { callback({ ok: true, - msg: "Deleted Successfully.", + msg: "successDeleted", + msgi18n: true, }); await sendAPIKeyList(socket); @@ -109,7 +111,8 @@ module.exports.apiKeySocketHandler = (socket) => { callback({ ok: true, - msg: "Disabled Successfully.", + msg: "successDisabled", + msgi18n: true, }); await sendAPIKeyList(socket); @@ -136,7 +139,8 @@ module.exports.apiKeySocketHandler = (socket) => { callback({ ok: true, - msg: "Enabled Successfully", + msg: "successEnabled", + msgi18n: true, }); await sendAPIKeyList(socket); diff --git a/server/socket-handlers/docker-socket-handler.js b/server/socket-handlers/docker-socket-handler.js index 6a14294cf..95a60bcd3 100644 --- a/server/socket-handlers/docker-socket-handler.js +++ b/server/socket-handlers/docker-socket-handler.js @@ -40,7 +40,8 @@ module.exports.dockerSocketHandler = (socket) => { callback({ ok: true, - msg: "Deleted", + msg: "successDeleted", + msgi18n: true, }); } catch (e) { diff --git a/server/socket-handlers/general-socket-handler.js b/server/socket-handlers/general-socket-handler.js index 82129061e..2ef375dcd 100644 --- a/server/socket-handlers/general-socket-handler.js +++ b/server/socket-handlers/general-socket-handler.js @@ -55,7 +55,11 @@ module.exports.generalSocketHandler = (socket, server) => { testChrome(executable).then((version) => { callback({ ok: true, - msg: "Found Chromium/Chrome. Version: " + version, + msg: { + key: "foundChromiumVersion", + values: [ version ], + }, + msgi18n: true, }); }).catch((e) => { callback({ diff --git a/server/socket-handlers/maintenance-socket-handler.js b/server/socket-handlers/maintenance-socket-handler.js index 656f5bb24..7de13fe57 100644 --- a/server/socket-handlers/maintenance-socket-handler.js +++ b/server/socket-handlers/maintenance-socket-handler.js @@ -30,7 +30,8 @@ module.exports.maintenanceSocketHandler = (socket) => { callback({ ok: true, - msg: "Added Successfully.", + msg: "successAdded", + msgi18n: true, maintenanceID, }); @@ -97,7 +98,8 @@ module.exports.maintenanceSocketHandler = (socket) => { callback({ ok: true, - msg: "Added Successfully.", + msg: "successAdded", + msgi18n: true, }); } catch (e) { @@ -131,7 +133,8 @@ module.exports.maintenanceSocketHandler = (socket) => { callback({ ok: true, - msg: "Added Successfully.", + msg: "successAdded", + msgi18n: true, }); } catch (e) { @@ -250,7 +253,8 @@ module.exports.maintenanceSocketHandler = (socket) => { callback({ ok: true, - msg: "Deleted Successfully.", + msg: "successDeleted", + msgi18n: true, }); await server.sendMaintenanceList(socket); @@ -283,7 +287,8 @@ module.exports.maintenanceSocketHandler = (socket) => { callback({ ok: true, - msg: "Paused Successfully.", + msg: "successPaused", + msgi18n: true, }); await server.sendMaintenanceList(socket); @@ -316,7 +321,8 @@ module.exports.maintenanceSocketHandler = (socket) => { callback({ ok: true, - msg: "Resume Successfully", + msg: "successResumed", + msgi18n: true, }); await server.sendMaintenanceList(socket); diff --git a/server/socket-handlers/proxy-socket-handler.js b/server/socket-handlers/proxy-socket-handler.js index eb8c5c866..9e80371d7 100644 --- a/server/socket-handlers/proxy-socket-handler.js +++ b/server/socket-handlers/proxy-socket-handler.js @@ -47,7 +47,8 @@ module.exports.proxySocketHandler = (socket) => { callback({ ok: true, - msg: "Deleted", + msg: "successDeleted", + msgi18n: true, }); } catch (e) { diff --git a/server/socket-handlers/status-page-socket-handler.js b/server/socket-handlers/status-page-socket-handler.js index 427f52d0c..ee1c68d3b 100644 --- a/server/socket-handlers/status-page-socket-handler.js +++ b/server/socket-handlers/status-page-socket-handler.js @@ -284,7 +284,8 @@ module.exports.statusPageSocketHandler = (socket) => { callback({ ok: true, - msg: "OK!" + msg: "successAdded", + msgi18n: true, }); } catch (error) { diff --git a/src/lang/en.json b/src/lang/en.json index 11dae4969..c75dd7c86 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -821,5 +821,22 @@ "noOrBadCertificate": "No/Bad Certificate", "gamedigGuessPort": "Gamedig: Guess Port", "gamedigGuessPortDescription": "The port used by Valve Server Query Protocol may be different from the client port. Try this if the monitor cannot connect to your server.", - "Saved.": "Saved." + "Saved.": "Saved.", + "authUserInactiveOrDeleted": "The user is inactive or deleted.", + "authInvalidToken": "Invalid Token.", + "authIncorrectCreds": "Incorrect username or password.", + "2faAlreadyEnabled": "2FA is already enabled.", + "2faEnabled": "2FA Enabled.", + "2faDisabled": "2FA Disabled.", + "successAdded": "Added Successfully.", + "successResumed": "Resumed Successfully.", + "successPaused": "Paused Successfully.", + "successDeleted": "Deleted Successfully.", + "successEdited": "Edited Successfully.", + "successAuthChangePassword": "Password has been updated successfully.", + "successBackupRestored": "Backup successfully restored.", + "successDisabled": "Disabled Successfully.", + "successEnabled": "Enabled Successfully.", + "tagNotFound": "Tag not found.", + "foundChromiumVersion": "Found Chromium/Chrome. Version: {0}" }