Make main branch up-to-date with public servers

This commit is contained in:
Vortrex
2022-04-23 15:17:18 -05:00
parent 6ad4e9bf66
commit 7f8875d547
3 changed files with 158 additions and 0 deletions

31
scripts/client/locale.js Normal file
View File

@@ -0,0 +1,31 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: locale.js
// DESC: Provides locale functions and usage
// TYPE: Client (JavaScript)
// ===========================================================================
function getLocaleString(stringName, ...args) {
if(typeof getServerData().localeStrings[stringName] == undefined) {
return "";
}
let tempString = getServerData().localeStrings[stringName];
for(let i = 1; i <= args.length; i++) {
tempString = tempString.replace(`{${i}}`, args[i-1]);
}
return tempString;
}
// ===========================================================================
function receiveLocaleStringFromServer(stringName, stringValue) {
logToConsole(LOG_INFO, `[VRR.Locale]: Received locale string "${stringName}" from server (${stringValue})`);
getServerData().localeStrings[stringName] = stringValue;
}
// ===========================================================================