Client-side locale stuff

This commit is contained in:
Vortrex
2022-04-05 23:59:06 -05:00
parent 09e0eab8d9
commit 8cecd232a4

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

@@ -0,0 +1,26 @@
// ===========================================================================
// 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) {
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) {
getServerData().localeStrings[stringName] = stringValue;
}
// ===========================================================================