forked from MapComplete/MapComplete
Playing around with translatiosn
This commit is contained in:
parent
6f8c29d401
commit
fd6f77c98e
7 changed files with 54 additions and 36 deletions
19
UI/Base/Combine.ts
Normal file
19
UI/Base/Combine.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
import {UIElement} from "../UIElement";
|
||||
import Translations from "../i18n/Translations";
|
||||
|
||||
export default class Combine extends UIElement {
|
||||
private uiElements: UIElement[];
|
||||
|
||||
constructor(uiElements: (string | UIElement)[]) {
|
||||
super(undefined);
|
||||
this.uiElements = uiElements.map(Translations.W);
|
||||
}
|
||||
|
||||
InnerRender(): string {
|
||||
let elements = "";
|
||||
for (const element of this.uiElements) {
|
||||
elements += element.Render();
|
||||
}
|
||||
return elements;
|
||||
}
|
||||
}
|
|
@ -13,18 +13,23 @@ export abstract class UIElement {
|
|||
this.id = "ui-element-" + UIElement.nextId;
|
||||
this._source = source;
|
||||
UIElement.nextId++;
|
||||
if (UIElement.nextId % 100 == 0) {
|
||||
|
||||
console.log(UIElement.nextId)
|
||||
}
|
||||
this.ListenTo(source);
|
||||
}
|
||||
|
||||
|
||||
public ListenTo(source: UIEventSource<any>) {
|
||||
if (source === undefined) {
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
const self = this;
|
||||
source.addCallback(() => {
|
||||
self.Update();
|
||||
})
|
||||
return this;
|
||||
}
|
||||
|
||||
private _onClick: () => void;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue