Fix non-appearing new icon, remove debug outputs

This commit is contained in:
Pieter Vander Vennet 2021-12-14 17:29:21 +01:00
parent 7dfbe5f4b4
commit 90fc0e0840
7 changed files with 15 additions and 13 deletions

View file

@ -238,7 +238,7 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
return [a.substr(0, index), a.substr(index + sep.length)];
}
public static SubstituteKeys(txt: string | undefined, tags: any): string | undefined {
public static SubstituteKeys(txt: string | undefined, tags: any, useLang?: string): string | undefined {
if (txt === undefined) {
return undefined
}
@ -258,6 +258,10 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
v = date.toISOString()
}
if(useLang !== undefined && v?.translations !== undefined){
v = v.translations[useLang] ?? v.translations["*"] ?? (v.textFor !== undefined ? v.textFor(useLang) : v);
}
if(v.InnerConstructElement !== undefined){
console.warn("SubstituteKeys received a BaseUIElement to substitute in - this is probably a bug and will be downcast to a string\nThe key is", key,"\nThe value is", v)
v = ( <HTMLElement> v.InnerConstructElement())?.innerText