forked from MapComplete/MapComplete
Translations
This commit is contained in:
parent
615bbec05d
commit
369c19a58a
34 changed files with 287 additions and 173 deletions
|
@ -1,16 +1,30 @@
|
|||
import { UIElement } from "../UIElement"
|
||||
import Locale from "./Locale"
|
||||
import {FixedUiElement} from "../Base/FixedUiElement";
|
||||
|
||||
|
||||
export default class Translation extends UIElement{
|
||||
protected InnerRender(): string {
|
||||
return this.translations[Locale.language.data]
|
||||
}
|
||||
export default class Translation extends UIElement {
|
||||
|
||||
public readonly translations: object
|
||||
|
||||
|
||||
constructor(translations: object) {
|
||||
super(Locale.language)
|
||||
this.translations = translations
|
||||
}
|
||||
|
||||
public R(): string {
|
||||
return new Translation(this.translations).Render();
|
||||
}
|
||||
|
||||
InnerRender(): string {
|
||||
const txt = this.translations[Locale.language.data];
|
||||
if (txt !== undefined) {
|
||||
return txt;
|
||||
}
|
||||
const en = this.translations["en"];
|
||||
console.warn("No translation for language ", Locale.language.data, "for",en);
|
||||
return en;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue