forked from MapComplete/MapComplete
Full, interactive i18n (still some quests to enable it though)
This commit is contained in:
parent
fd6f77c98e
commit
0f2dff8f41
15 changed files with 205 additions and 90 deletions
|
@ -2,18 +2,30 @@ import {UIElement} from "../UIElement";
|
|||
import Translations from "../i18n/Translations";
|
||||
|
||||
export default class Combine extends UIElement {
|
||||
private uiElements: UIElement[];
|
||||
private uiElements: (string | UIElement)[];
|
||||
|
||||
constructor(uiElements: (string | UIElement)[]) {
|
||||
super(undefined);
|
||||
this.uiElements = uiElements.map(Translations.W);
|
||||
this.uiElements = uiElements;
|
||||
}
|
||||
|
||||
InnerRender(): string {
|
||||
let elements = "";
|
||||
for (const element of this.uiElements) {
|
||||
elements += element.Render();
|
||||
if (element instanceof UIElement) {
|
||||
elements += element.Render();
|
||||
} else {
|
||||
elements += element;
|
||||
}
|
||||
}
|
||||
return elements;
|
||||
}
|
||||
|
||||
protected InnerUpdate(htmlElement: HTMLElement) {
|
||||
for (const element of this.uiElements) {
|
||||
if (element instanceof UIElement) {
|
||||
element.Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue