From fbdd36b270ee9138c61becef0906eaeca69ba1b6 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Tue, 6 Apr 2021 21:10:18 +0200 Subject: [PATCH] Small fix: restore special components --- Customizations/JSON/LayerConfig.ts | 2 +- UI/SubstitutedTranslation.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Customizations/JSON/LayerConfig.ts b/Customizations/JSON/LayerConfig.ts index 0d1a160..ba6bd4f 100644 --- a/Customizations/JSON/LayerConfig.ts +++ b/Customizations/JSON/LayerConfig.ts @@ -332,7 +332,7 @@ export default class LayerConfig { function render(tr: TagRenderingConfig, deflt?: string) { const str = (tr?.GetRenderValue(tags.data)?.txt ?? deflt); - return SubstitutedTranslation.SubstituteKeys(str, tags.data); + return SubstitutedTranslation.SubstituteKeys(str, tags.data).replace(/{.*}/g, ""); } const iconSize = render(this.iconSize, "40,40,center").split(","); diff --git a/UI/SubstitutedTranslation.ts b/UI/SubstitutedTranslation.ts index 4483887..24c200f 100644 --- a/UI/SubstitutedTranslation.ts +++ b/UI/SubstitutedTranslation.ts @@ -54,7 +54,7 @@ export class SubstitutedTranslation extends UIElement { for (const key in tags) { txt = txt.replace(new RegExp("{" + key + "}", "g"), tags[key]) } - return txt.replace(/{.*}/g, ""); + return txt; } private static GenerateMap() { @@ -117,8 +117,8 @@ export class SubstitutedTranslation extends UIElement { } } - // IF we end up here, no changes have to be made - return [new FixedUiElement(template)]; + // IF we end up here, no changes have to be made - except to remove any resting {} + return [new FixedUiElement(template.replace(/{.*}/g, ""))]; } } \ No newline at end of file