forked from MapComplete/MapComplete
Chore: code cleanup
This commit is contained in:
parent
9186479cae
commit
ea640468e8
1 changed files with 9 additions and 16 deletions
|
@ -191,26 +191,25 @@ export class Translation extends BaseUIElement {
|
|||
|
||||
InnerConstructElement(): HTMLElement {
|
||||
const el = document.createElement("span")
|
||||
const self = this
|
||||
if (self.txt) {
|
||||
el.innerHTML = self.txt
|
||||
if (this.txt) {
|
||||
el.innerHTML = this.txt
|
||||
}
|
||||
if (self.translations["*"] !== undefined) {
|
||||
if (this.translations["*"] !== undefined) {
|
||||
return el
|
||||
}
|
||||
|
||||
Locale.language.addCallback((_) => {
|
||||
if (self.isDestroyed) {
|
||||
if (this.isDestroyed) {
|
||||
return true
|
||||
}
|
||||
if (self.txt === undefined) {
|
||||
if (this.txt === undefined) {
|
||||
el.innerHTML = ""
|
||||
} else {
|
||||
el.innerHTML = self.txt
|
||||
el.innerHTML = this.txt
|
||||
}
|
||||
})
|
||||
|
||||
if (self.context === undefined || self.context?.indexOf(":") < 0) {
|
||||
if (this.context === undefined || this.context?.indexOf(":") < 0) {
|
||||
return el
|
||||
}
|
||||
|
||||
|
@ -220,7 +219,7 @@ export class Translation extends BaseUIElement {
|
|||
if (!doShow) {
|
||||
return
|
||||
}
|
||||
const linkToWeblate = new LinkToWeblate(self.context, self.translations)
|
||||
const linkToWeblate = new LinkToWeblate(this.context, this.translations)
|
||||
wrapper.appendChild(linkToWeblate.ConstructElement())
|
||||
return true
|
||||
})
|
||||
|
@ -231,13 +230,7 @@ export class Translation extends BaseUIElement {
|
|||
public SupportedLanguages(): string[] {
|
||||
const langs = []
|
||||
for (const translationsKey in this.translations) {
|
||||
if (!this.translations.hasOwnProperty(translationsKey)) {
|
||||
continue
|
||||
}
|
||||
if (translationsKey === "#") {
|
||||
continue
|
||||
}
|
||||
if (!this.translations.hasOwnProperty(translationsKey)) {
|
||||
if (translationsKey === "#" || translationsKey.startsWith("_")) {
|
||||
continue
|
||||
}
|
||||
langs.push(translationsKey)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue