Add locales fallback (!197)

Fixes [#310](https://dev.sp-tarkov.com/SPT-AKI/Issues/issues/310)

Co-authored-by: Merijn Hendriks <merijn.d.hendriks@gmail.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/197
Co-authored-by: Merijn Hendriks <senko-san@noreply.dev.sp-tarkov.com>
Co-committed-by: Merijn Hendriks <senko-san@noreply.dev.sp-tarkov.com>
This commit is contained in:
Merijn Hendriks 2024-01-15 12:45:24 +00:00 committed by chomp
parent cff4a45291
commit bdc505bed6
2 changed files with 20 additions and 34 deletions

View File

@ -1,28 +0,0 @@
{
"menu": {
"206 - Wrong email or password": "Wrong email or password",
"213 - Error connecting to auth server": "Authorization is unavailable now, please try again later.",
"240 - Servers temporarily unavailable. Please, try later.": "Server maintenance",
"ASSEMBLE": "ASSEMBLE",
"AUTHORIZATION": "AUTHORIZATION",
"BATTLEYE_ANTICHEAT_BadServiceVersion": "Bad service version",
"BATTLEYE_ANTICHEAT_ClientNotResponding": "Anticheat connection failed",
"BATTLEYE_ANTICHEAT_CorruptedData": "The integrity of the game failed to validate. Reinstall anticheat",
"BATTLEYE_ANTICHEAT_CorruptedMemory": "Corrupted memory. The integrity of the protection failed to validate. Reinstall anticheat",
"BATTLEYE_ANTICHEAT_DisallowedProgram": "Disallowed program running",
"BATTLEYE_ANTICHEAT_FailedToLoadAnticheat": "Anticheat loading failed.",
"BATTLEYE_ANTICHEAT_GameRestartRequired": "Game restart required",
"BATTLEYE_ANTICHEAT_GlobalBan": "The player has been banned by BE",
"BATTLEYE_ANTICHEAT_QueryTimeout": "Anticheat connection failed. Please restart the game",
"BATTLEYE_ANTICHEAT_WinAPIFailure": "A critical Windows API call failed",
"BATTLEYE_ServiceNeedsToBeUpdated": "Anticheat is outdated. Game restart required",
"BATTLEYE_ServiceNotRunningProperly": "Anticheat is running incorrectly. Game restart required",
"BATTLEYE_UnknownRestartReason": "Anticheat is running incorrectly. Game restart required",
"EXIT": "EXIT",
"NEXT": "NEXT",
"Place in queue:": "Place in queue:",
"Profile data loading...": "Loading profile data...",
"SABER_ANTICHEAT_AnticheatConnectionFailed": "Anticheat connection failed",
"Servers are currently at full capacity": "Servers are currently at full capacity"
}
}

View File

@ -151,9 +151,16 @@ export class DataCallbacks
*/
public getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<string>
{
return this.httpResponse.getBody(
this.databaseServer.getTables().locales.menu[url.replace("/client/menu/locale/", "")],
);
const localeId = url.replace("/client/menu/locale/", "");
const tables = this.databaseServer.getTables();
let result = tables.locales.menu[localeId];
if (result === undefined)
{
result = tables.locales.menu["en"];
}
return this.httpResponse.getBody(result);
}
/**
@ -161,9 +168,16 @@ export class DataCallbacks
*/
public getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string
{
return this.httpResponse.getUnclearedBody(
this.databaseServer.getTables().locales.global[url.replace("/client/locale/", "")],
);
const localeId = url.replace("/client/locale/", "");
const tables = this.databaseServer.getTables();
let result = tables.locales.global[localeId];
if (result === undefined)
{
result = tables.locales.global[localeId];
}
return this.httpResponse.getUnclearedBody(result);
}
/**