🆕 Added support for JSON5

This commit is contained in:
duckietm
2026-05-18 16:14:38 +02:00
parent b6a26fbd84
commit 31df26bd1b
17 changed files with 494 additions and 281 deletions
@@ -1,6 +1,7 @@
import { ILocalizationManager } from '@nitrots/api';
import { BadgePointLimitsEvent, GetCommunication } from '@nitrots/communication';
import { GetConfiguration } from '@nitrots/configuration';
import { parseConfigJsonFromResponse } from '@nitrots/utils';
import { BadgeBaseAndLevel } from './BadgeBaseAndLevel';
export class LocalizationManager implements ILocalizationManager
@@ -42,11 +43,11 @@ export class LocalizationManager implements ILocalizationManager
try
{
data = await response.json();
data = await parseConfigJsonFromResponse(response, url);
}
catch(parseErr)
{
throw new Error(`Invalid JSON in localization file "${ url }" — the URL may be wrong. Check "external.texts.url" in ui-config.json (${ parseErr.message })`);
throw new Error(`Invalid localization file "${ url }" — JSON/JSON5 parse failed. Check "external.texts.url" in ui-config.json (${ parseErr.message })`);
}
this.parseLocalization(data);