Refactoring: Translation is no longer a BaseUIElement

This commit is contained in:
Pieter Vander Vennet 2025-08-26 04:23:28 +02:00
parent 5ea2414204
commit 020a1f8c3b
3 changed files with 7 additions and 18 deletions

View file

@ -1,10 +1,8 @@
import Locale from "./Locale"
import { Utils } from "../../Utils"
import BaseUIElement from "../BaseUIElement"
import { Store } from "../../Logic/UIEventSource"
import { VariableUiElement } from "../Base/VariableUIElement"
export class Translation extends BaseUIElement {
export class Translation {
public static forcedLanguage = undefined
public readonly translations: Record<string, string>
@ -27,8 +25,6 @@ export class Translation extends BaseUIElement {
context?: string,
strictLanguages?: boolean
) {
super()
this._strictLanguages = strictLanguages
if (translations === undefined) {
@ -217,9 +213,9 @@ export class Translation extends BaseUIElement {
return this.OnEveryLanguage((str) => str.replace(new RegExp(a, "g"), b))
}
InnerConstructElement() {
return new VariableUiElement(this.current).InnerConstructElement()
}
/*InnerConstructElement() {
return new VariableUiElement(this.current).SetClass("border border-red-500").InnerConstructElement()
}*/
/**
* Build a new translation which only contains the first sentence of every language
@ -269,9 +265,6 @@ export class Translation extends BaseUIElement {
public ExtractImages(isIcon = false): string[] {
const allIcons: string[] = []
for (const key in this.translations) {
if (!this.translations.hasOwnProperty(key)) {
continue
}
const render = this.translations[key]
if (isIcon) {
@ -310,9 +303,6 @@ export class Translation extends BaseUIElement {
return allIcons.filter((icon) => icon != undefined)
}
AsMarkdown(): string {
return this.txt
}
}
export class TypedTranslation<T extends Record<string, any>> extends Translation {