forked from MapComplete/MapComplete
Refactoring: Translation is no longer a BaseUIElement
This commit is contained in:
parent
5ea2414204
commit
020a1f8c3b
3 changed files with 7 additions and 18 deletions
|
@ -318,9 +318,9 @@ export default class PointRenderingConfig extends WithContextLoader {
|
|||
const cssClassesLabel = this.labelCssClasses?.GetRenderValue(tags.data)?.txt
|
||||
return new VariableUiElement(
|
||||
tags.map((tags) => {
|
||||
const label = this.label
|
||||
const label = new VariableUiElement(this.label
|
||||
?.GetRenderValue(tags)
|
||||
?.Subs(tags)
|
||||
?.Subs(tags).current)
|
||||
?.SetClass("flex items-center justify-center absolute marker-label")
|
||||
?.SetClass(cssClassesLabel)
|
||||
if (cssLabel) {
|
||||
|
|
|
@ -18,11 +18,10 @@ import { Store, UIEventSource } from "../../Logic/UIEventSource"
|
|||
import NearbyFeatureSource from "../../Logic/FeatureSource/Sources/NearbyFeatureSource"
|
||||
import {
|
||||
SummaryTileSource,
|
||||
SummaryTileSourceRewriter,
|
||||
SummaryTileSourceRewriter
|
||||
} from "../../Logic/FeatureSource/TiledFeatureSource/SummaryTileSource"
|
||||
import { ShowDataLayerOptions } from "../../UI/Map/ShowDataLayerOptions"
|
||||
import { ClusterGrouping } from "../../Logic/FeatureSource/TiledFeatureSource/ClusteringFeatureSource"
|
||||
import { OsmTags } from "../OsmFeature"
|
||||
|
||||
export class WithSpecialLayers extends WithChangesState {
|
||||
readonly favourites: FavouritesFeatureSource
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue