Add small script to autoconvert images to use tags instead

This commit is contained in:
Pieter Vander Vennet 2022-02-18 03:15:37 +01:00
parent fb4a3ea99a
commit 902b766410
2 changed files with 70 additions and 2 deletions

View file

@ -130,13 +130,16 @@ export class Translation extends BaseUIElement {
}
public Subs(text: any): Translation {
return this.OnEveryLanguage((template, lang) => Utils.SubstituteKeys(template, text, lang))
}
public OnEveryLanguage(f: (s: string, language: string) => string): Translation {
const newTranslations = {};
for (const lang in this.translations) {
if (!this.translations.hasOwnProperty(lang)) {
continue;
}
let template: string = this.translations[lang];
newTranslations[lang] = Utils.SubstituteKeys(template, text, lang);
newTranslations[lang] = f(this.translations[lang], lang);
}
return new Translation(newTranslations);