From 37df697b3d1b0d50f50d562fe1329430d331d180 Mon Sep 17 00:00:00 2001 From: Official Noob <31563761+OfficialNoob@users.noreply.github.com> Date: Wed, 7 Aug 2019 17:08:29 +0100 Subject: [PATCH] Added Utils for lang --- LANG.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/LANG.js b/LANG.js index 0a197278..7dc08c3a 100644 --- a/LANG.js +++ b/LANG.js @@ -1,7 +1,22 @@ // File to store strings for diffrent languages + + + // Utils + function getErrorMessage(lang, statusCode) { + if(lang.has(statusCode)) return lang.get(statusCode); + return lang.get('Unknown').concat(" Error code: ") + statusCode; + } + function MSG(lang, message) { + if(lang.has(message)) return lang.get(message); + console.warn("Could not find key " + message + " for lang "+lang); + return ""; + } + + //Declare Maps var EN_US = new Map(); - + + // Main EN_US.set(400, 'Server said this request was invalid"') .set(429, 'You have submitted too many sponsor times for this one video, are you sure there are this many?') .set(409, 'This has already been submitted before')