From 70e74144edfe95e4937c631cb6d8063b1ac87dbc Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Mon, 4 Apr 2022 02:18:31 +0200 Subject: [PATCH] Add translation button to inline renderings --- UI/Input/InputElementWrapper.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/UI/Input/InputElementWrapper.ts b/UI/Input/InputElementWrapper.ts index a671a0027..9006956c5 100644 --- a/UI/Input/InputElementWrapper.ts +++ b/UI/Input/InputElementWrapper.ts @@ -17,11 +17,8 @@ export default class InputElementWrapper extends InputElement { mapping.set(key, inputElement) // Bit of a hack: the SubstitutedTranslation expects a special rendering, but those are formatted '{key()}' instead of '{key}', so we substitute it first - const newTranslations = {} - for (const lang in translation.translations) { - newTranslations[lang] = translation.translations[lang].replace("{" + key + "}", "{" + key + "()}") - } - this._renderElement = new SubstitutedTranslation(new Translation(newTranslations), tags, state, mapping) + translation = translation.OnEveryLanguage((txt) => txt.replace("{" + key + "}", "{" + key + "()}")) + this._renderElement = new SubstitutedTranslation(translation, tags, state, mapping) } GetValue(): UIEventSource {