diff --git a/UI/Popup/TagRenderingQuestion.ts b/UI/Popup/TagRenderingQuestion.ts index 60521e273..7e32b1263 100644 --- a/UI/Popup/TagRenderingQuestion.ts +++ b/UI/Popup/TagRenderingQuestion.ts @@ -11,7 +11,7 @@ import {SaveButton} from "./SaveButton"; import {VariableUiElement} from "../Base/VariableUIElement"; import Translations from "../i18n/Translations"; import {FixedUiElement} from "../Base/FixedUiElement"; -import {Translation} from "../i18n/Translation"; +import {Translation, TypedTranslation} from "../i18n/Translation"; import Constants from "../../Models/Constants"; import {SubstitutedTranslation} from "../SubstitutedTranslation"; import {TagsFilter} from "../../Logic/Tags/TagsFilter"; @@ -51,7 +51,7 @@ export default class TagRenderingQuestion extends Combine { const applicableMappingsSrc = UIEventSource.ListStabilized(tags.map(tags => { - const applicableMappings: { if: TagsFilter, icon?: string, then: any, ifnot?: TagsFilter, addExtraTags: Tag[] }[] = [] + const applicableMappings: { if: TagsFilter, icon?: string, then: TypedTranslation, ifnot?: TagsFilter, addExtraTags: Tag[] }[] = [] for (const mapping of configuration.mappings ?? []) { if (mapping.hideInAnswer === true) { continue @@ -158,7 +158,7 @@ export default class TagRenderingQuestion extends Combine { private static GenerateInputElement( state, configuration: TagRenderingConfig, - applicableMappings: { if: TagsFilter, then: any, icon?: string, ifnot?: TagsFilter, addExtraTags: Tag[] }[], + applicableMappings: { if: TagsFilter, then: TypedTranslation, icon?: string, ifnot?: TagsFilter, addExtraTags: Tag[] }[], applicableUnit: Unit, tagsSource: UIEventSource, feedback: UIEventSource @@ -207,7 +207,7 @@ export default class TagRenderingQuestion extends Combine { applicableMappings.map((mapping, i) => { return { value: new And([mapping.if, ...allIfNotsExcept(i)]), - shown: Translations.T(mapping.then) + shown: mapping.then.Subs(tagsSource.data) } }) ) diff --git a/assets/layers/tree_node/tree_node.json b/assets/layers/tree_node/tree_node.json index f3bd0cfca..0931dde3f 100644 --- a/assets/layers/tree_node/tree_node.json +++ b/assets/layers/tree_node/tree_node.json @@ -31,6 +31,28 @@ "es": "Árbol" }, "mappings": [ + { + "if": { + "and": ["name~*","species:wikidata~*"] + }, + "then": { + "*": "{name} ({wikidata_label(species:wikidata)})" + } + }, + { + "if": { + "and": ["name~*"] + }, + "then": { + "*": "{name}" + } + }, + { + "if": "species:wikidata~*", + "then": { + "*": "{wikidata_label(species:wikidata)}" + } + }, { "if": "species~*", "then": {