Files
GTA4RP/scripts/client/locale.js
2022-04-23 15:17:18 -05:00

31 lines
1.1 KiB
JavaScript

// ===========================================================================
// 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;
}
// ===========================================================================