Use locale strings
This commit is contained in:
@@ -2149,7 +2149,7 @@ function reloadAllBusinessesCommand(command, params, client) {
|
|||||||
setAllBusinessIndexes();
|
setAllBusinessIndexes();
|
||||||
cacheAllBusinessItems();
|
cacheAllBusinessItems();
|
||||||
|
|
||||||
announceAdminAction(`All businesses have been reloaded by an admin!`);
|
announceAdminAction(`AllBusinessesReloaded`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -376,7 +376,7 @@ function setWeatherCommand(command, params, client) {
|
|||||||
|
|
||||||
getServerConfig().needsSaved = true;
|
getServerConfig().needsSaved = true;
|
||||||
|
|
||||||
announceAdminAction("ServerTimeSet", getPlayerName(client), getGameConfig().weatherNames[getServerGame()][toInteger(weatherId)]);
|
announceAdminAction("ServerWeatherSet", getPlayerName(client), getGameConfig().weatherNames[getServerGame()][toInteger(weatherId)]);
|
||||||
updateServerRules();
|
updateServerRules();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -467,7 +467,7 @@ function toggleServerLogoCommand(command, params, client) {
|
|||||||
|
|
||||||
updatePlayerShowLogoState(null, getServerConfig().useLogo);
|
updatePlayerShowLogoState(null, getServerConfig().useLogo);
|
||||||
|
|
||||||
announceAdminAction(`${getPlayerName(client)}{MAINCOLOUR}${getBoolRedGreenInlineColour(doesServerHaveServerLogoEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().useLogo))}`);
|
//announceAdminAction(`${getPlayerName(client)}{MAINCOLOUR}${getBoolRedGreenInlineColour(doesServerHaveServerLogoEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().useLogo))}`);
|
||||||
updateServerRules();
|
updateServerRules();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -629,7 +629,7 @@ function toggleServerUseRealWorldTimeCommand(command, params, client) {
|
|||||||
|
|
||||||
getServerConfig().needsSaved = true;
|
getServerConfig().needsSaved = true;
|
||||||
|
|
||||||
announceAdminAction(`${getPlayerName(client)}{MAINCOLOUR} turned real-world time ${getServerConfig().useRealTime} for this server (GMT ${addPositiveNegativeSymbol(getServerConfig().realTimeZone)})`);
|
//announceAdminAction(`${getPlayerName(client)}{MAINCOLOUR} turned real-world time ${getServerConfig().useRealTime} for this server (GMT ${addPositiveNegativeSymbol(getServerConfig().realTimeZone)})`);
|
||||||
updateServerGameTime();
|
updateServerGameTime();
|
||||||
updateServerRules();
|
updateServerRules();
|
||||||
return true;
|
return true;
|
||||||
@@ -655,7 +655,7 @@ function setServerRealWorldTimeZoneCommand(command, params, client) {
|
|||||||
getServerConfig().realTimeZone = toInteger(params);
|
getServerConfig().realTimeZone = toInteger(params);
|
||||||
getServerConfig().needsSaved = true;
|
getServerConfig().needsSaved = true;
|
||||||
|
|
||||||
announceAdminAction(`${getPlayerName(client)} {MAINCOLOUR}set the time zone for in-game's real-world time to GMT ${addPositiveNegativeSymbol(getServerConfig().realTimeZone)}`);
|
//announceAdminAction(`${getPlayerName(client)} {MAINCOLOUR}set the time zone for in-game's real-world time to GMT ${addPositiveNegativeSymbol(getServerConfig().realTimeZone)}`);
|
||||||
updateServerGameTime();
|
updateServerGameTime();
|
||||||
updateServerRules();
|
updateServerRules();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ function setPayDayBonusMultiplier(command, params, client) {
|
|||||||
|
|
||||||
getGlobalConfig().economy.grossIncomeMultiplier = newMultiplier;
|
getGlobalConfig().economy.grossIncomeMultiplier = newMultiplier;
|
||||||
|
|
||||||
announceAdminAction(`${client.name} set payday bonus to ${newMultiplier*100}%`);
|
announceAdminAction(`PaydayBonusSet`, `{adminRed}${client.name}{MAINCOLOUR}`, `{ALTCOLOUR}${newMultiplier*100}%{MAINCOLOUR}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -1297,7 +1297,7 @@ function reloadAllHousesCommand(command, params, client) {
|
|||||||
createAllHousePickups();
|
createAllHousePickups();
|
||||||
createAllHouseBlips();
|
createAllHouseBlips();
|
||||||
|
|
||||||
announceAdminAction(`All houses have been reloaded by an admin!`);
|
announceAdminAction(`HousesReloaded`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -43,6 +43,21 @@ function getLocaleString(client, stringName, ...args) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function getLanguageLocaleString(localeId, stringName, ...args) {
|
||||||
|
let tempString = getRawLocaleString(stringName, localeId);
|
||||||
|
if(tempString == "") {
|
||||||
|
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(let i = 1; i <= args.length; i++) {
|
||||||
|
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tempString;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
function getGroupedLocaleString(client, stringName, index, ...args) {
|
function getGroupedLocaleString(client, stringName, index, ...args) {
|
||||||
let tempString = getRawGroupedLocaleString(stringName, getPlayerData(client).locale, index);
|
let tempString = getRawGroupedLocaleString(stringName, getPlayerData(client).locale, index);
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,14 @@ function initMessagingScript() {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function announceAdminAction(messageText) {
|
function announceAdminAction(localeString, ...args) {
|
||||||
messagePlayerNormal(null, `⚠️ ${messageText}`, getColourByName("orange"));
|
let clients = getClients();
|
||||||
if(getServerConfig().discordEnabled) {
|
for(let i in clients) {
|
||||||
messageDiscord(`:warning: ${messageText}`);
|
let messageText = getLocaleString.apply(null, [clients[i], localeString, args]);
|
||||||
|
messagePlayerNormal(clients[i], `⚠️ ${messageText}`, getColourByName("orange"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
messageDiscordEventChannel(getLanguageLocaleString.apply(null, [getGlobalConfig().locale.defaultLanguageId, localeString, args]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ function reloadAllRadioStationsCommand(command, params, client) {
|
|||||||
getServerData().radioStations = loadRadioStationsFromDatabase();
|
getServerData().radioStations = loadRadioStationsFromDatabase();
|
||||||
setRadioStationIndexes();
|
setRadioStationIndexes();
|
||||||
|
|
||||||
announceAdminAction(`All radio stations have been reloaded by an admin!`);
|
announceAdminAction(`AllRadioStationsReloaded`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ function kickClientCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
announceAdminAction(`${getPlayerName(targetClient)} has been kicked from the server.`);
|
//getPlayerData(targetClient).customDisconnectReason = reason;
|
||||||
|
announceAdminAction(`PlayerKicked`, getPlayerName(targetClient));
|
||||||
targetClient.disconnect();
|
targetClient.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user