forked from MapComplete/MapComplete
Style: better styling of translate buttons, hide translate buttons where not applicable
This commit is contained in:
parent
f0f0292d0c
commit
08a604c3f5
10 changed files with 22 additions and 16 deletions
|
@ -15,13 +15,13 @@ export default class WithContextLoader {
|
|||
*
|
||||
* The found value is interpreted as a tagrendering and fetched/parsed
|
||||
* */
|
||||
public tr(key: string, deflt) {
|
||||
public tr(key: string, deflt: undefined, translationContext?: string) {
|
||||
const v = this._json[key]
|
||||
if (v === undefined || v === null) {
|
||||
if (deflt === undefined) {
|
||||
return undefined
|
||||
}
|
||||
return new TagRenderingConfig(deflt, `${this._context}.${key}.default value`)
|
||||
return new TagRenderingConfig(deflt, `${translationContext ?? this._context}.${key}.default value`)
|
||||
}
|
||||
if (typeof v === "string") {
|
||||
const shared = SharedTagRenderings.SharedTagRendering.get(v)
|
||||
|
@ -29,7 +29,7 @@ export default class WithContextLoader {
|
|||
return shared
|
||||
}
|
||||
}
|
||||
return new TagRenderingConfig(v, `${this._context}.${key}`)
|
||||
return new TagRenderingConfig(v, `${translationContext ?? this._context}.${key}`)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue