forked from MapComplete/MapComplete
Add small script to autoconvert images to use tags instead
This commit is contained in:
parent
fb4a3ea99a
commit
902b766410
2 changed files with 70 additions and 2 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue