From f3014690722956fbe656a27cc549c7d4300d1a86 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Mon, 1 Aug 2022 11:35:32 -0500 Subject: [PATCH] Automated report for missing indexed locale strings --- scripts/server/locale.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/scripts/server/locale.js b/scripts/server/locale.js index d8758b49..7be4cabf 100644 --- a/scripts/server/locale.js +++ b/scripts/server/locale.js @@ -84,14 +84,12 @@ function getGroupedLocaleString(client, stringName, index, ...args) { // =========================================================================== function getRawLocaleString(stringName, localeId) { - let tempString = getLocaleStrings()[localeId][stringName]; - - if (typeof tempString == "undefined") { - logToConsole(LOG_WARN, `[VRR.Locale] Locale string missing for ${tempString} on language ${getLocaleData(localeId).englishName}[${localeId}]`); - submitBugReport(client, `(AUTOMATED REPORT) Locale string is missing for "${tempString}" on language ${getLocaleData(localeId).englishName}[${localeId}]`); + if (typeof getLocaleStrings()[localeId][stringName] == "undefined") { + logToConsole(LOG_WARN, `[VRR.Locale] Locale string missing for ${getLocaleStrings()[localeId][stringName]} on language ${getLocaleData(localeId).englishName}[${localeId}]`); + submitBugReport(client, `(AUTOMATED REPORT) Locale string is missing for "${getLocaleStrings()[localeId][stringName]}" on language ${getLocaleData(localeId).englishName}[${localeId}]`); } - return tempString; + return getLocaleStrings()[localeId][stringName]; //if(findResourceByName("agrp_locale").exports.doesLocaleStringExist(localeId, stringName) == false) { // return ""; @@ -106,14 +104,12 @@ function getRawLocaleString(stringName, localeId) { // =========================================================================== function getRawGroupedLocaleString(stringName, localeId, index) { - let tempString = getLocaleStrings()[localeId][stringName][index]; - - if (typeof tempString == "undefined") { - logToConsole(LOG_WARN, `[VRR.Locale] Grouped locale string missing for index ${index} of string ${tempString} on language ${getLocaleData(localeId).englishName}[${localeId}]`); - submitBugReport(client, `(AUTOMATED REPORT) Grouped locale string is missing for index ${index} of string "${tempString}" on language ${getLocaleData(localeId).englishName}[${localeId}]`); + if (typeof getLocaleStrings()[localeId][stringName][index] == "undefined") { + logToConsole(LOG_WARN, `[VRR.Locale] Grouped locale string missing for index ${index} of string ${getLocaleStrings()[localeId][stringName][index]} on language ${getLocaleData(localeId).englishName}[${localeId}]`); + submitBugReport(client, `(AUTOMATED REPORT) Grouped locale string is missing for index ${index} of string "${getLocaleStrings()[localeId][stringName][index]}" on language ${getLocaleData(localeId).englishName}[${localeId}]`); } - return tempString; + return getLocaleStrings()[localeId][stringName][index]; //if(findResourceByName("agrp_locale").exports.doesLocaleStringExist(localeId, stringName) == false) { // return "";