Add translation button to inline renderings

This commit is contained in:
pietervdvn 2022-04-04 02:18:31 +02:00
parent e62f71a51d
commit 70e74144ed

View file

@ -17,11 +17,8 @@ export default class InputElementWrapper<T> extends InputElement<T> {
mapping.set(key, 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 // 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 = {} translation = translation.OnEveryLanguage((txt) => txt.replace("{" + key + "}", "{" + key + "()}"))
for (const lang in translation.translations) { this._renderElement = new SubstitutedTranslation(translation, tags, state, mapping)
newTranslations[lang] = translation.translations[lang].replace("{" + key + "}", "{" + key + "()}")
}
this._renderElement = new SubstitutedTranslation(new Translation(newTranslations), tags, state, mapping)
} }
GetValue(): UIEventSource<T> { GetValue(): UIEventSource<T> {