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
|
@ -388,7 +388,7 @@ export default class LayerConfig extends WithContextLoader {
|
||||||
readOnlyMode: true,
|
readOnlyMode: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
this.title = this.tr("title", undefined)
|
this.title = this.tr("title", undefined, translationContext)
|
||||||
this.isShown = TagUtils.TagD(json.isShown, context + ".isShown")
|
this.isShown = TagUtils.TagD(json.isShown, context + ".isShown")
|
||||||
|
|
||||||
this.deletion = null
|
this.deletion = null
|
||||||
|
|
|
@ -15,13 +15,13 @@ export default class WithContextLoader {
|
||||||
*
|
*
|
||||||
* The found value is interpreted as a tagrendering and fetched/parsed
|
* 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]
|
const v = this._json[key]
|
||||||
if (v === undefined || v === null) {
|
if (v === undefined || v === null) {
|
||||||
if (deflt === undefined) {
|
if (deflt === undefined) {
|
||||||
return 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") {
|
if (typeof v === "string") {
|
||||||
const shared = SharedTagRenderings.SharedTagRendering.get(v)
|
const shared = SharedTagRenderings.SharedTagRendering.get(v)
|
||||||
|
@ -29,7 +29,7 @@ export default class WithContextLoader {
|
||||||
return shared
|
return shared
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new TagRenderingConfig(v, `${this._context}.${key}`)
|
return new TagRenderingConfig(v, `${translationContext ?? this._context}.${key}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if t}
|
{#if t}
|
||||||
<span class={"inline-flex items-center "+cls}>
|
<span class={cls}>
|
||||||
<FromHtml src={txt}></FromHtml>
|
<FromHtml src={txt}></FromHtml>
|
||||||
<WeblateLink context={t.context}></WeblateLink>
|
<WeblateLink context={t.context}></WeblateLink>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -10,18 +10,17 @@
|
||||||
let linkToWeblate = Locale.showLinkToWeblate;
|
let linkToWeblate = Locale.showLinkToWeblate;
|
||||||
let linkOnMobile = Locale.showLinkOnMobile;
|
let linkOnMobile = Locale.showLinkOnMobile;
|
||||||
let language = Locale.language;
|
let language = Locale.language;
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
{#if context}
|
{#if !!context && context.indexOf(":") > 0}
|
||||||
{#if $linkOnMobile}
|
{#if $linkOnMobile}
|
||||||
<a href={LinkToWeblate.hrefToWeblate($language, context)} target="_blank" class="mx-1 weblate-link">
|
<a href={LinkToWeblate.hrefToWeblate($language, context)} target="_blank" class="mx-1 weblate-link">
|
||||||
<img src="./assets/svg/translate.svg" class="w-3 h-3 rounded-full font-gray" />
|
<img src="./assets/svg/translate.svg" class="font-gray" />
|
||||||
</a>
|
</a>
|
||||||
{:else if $linkToWeblate}
|
{:else if $linkToWeblate}
|
||||||
<a href={LinkToWeblate.hrefToWeblate($language, context)} class="weblate-link hidden-on-mobile mx-1" target="_blank">
|
<a href={LinkToWeblate.hrefToWeblate($language, context)} class="weblate-link hidden-on-mobile mx-1" target="_blank">
|
||||||
<img src="./assets/svg/translate.svg" class="w-3 h-3 rounded-full font-gray inline-block" />
|
<img src="./assets/svg/translate.svg" class="font-gray inline-block" />
|
||||||
</a>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -48,6 +48,7 @@ export default class OpeningHoursPickerTable extends InputElement<OpeningHour[]>
|
||||||
protected InnerConstructElement(): HTMLElement {
|
protected InnerConstructElement(): HTMLElement {
|
||||||
const table = document.createElement("table")
|
const table = document.createElement("table")
|
||||||
table.classList.add("oh-table")
|
table.classList.add("oh-table")
|
||||||
|
table.classList.add("no-weblate")
|
||||||
table.classList.add("relative") // Workaround for webkit-based viewers, see #1019
|
table.classList.add("relative") // Workaround for webkit-based viewers, see #1019
|
||||||
|
|
||||||
const cellHeightInPx = 14
|
const cellHeightInPx = 14
|
||||||
|
|
|
@ -76,6 +76,7 @@ export default class OpeningHoursVisualization extends Toggle {
|
||||||
new Loading(Translations.t.general.opening_hours.loadingCountry),
|
new Loading(Translations.t.general.opening_hours.loadingCountry),
|
||||||
tags.map((tgs) => tgs._country !== undefined)
|
tags.map((tgs) => tgs._country !== undefined)
|
||||||
)
|
)
|
||||||
|
this.SetClass("no-weblate")
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CreateFullVisualisation(oh: any): BaseUIElement {
|
private static CreateFullVisualisation(oh: any): BaseUIElement {
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
|
|
||||||
{#each specs as specpart}
|
{#each specs as specpart}
|
||||||
{#if typeof specpart === "string"}
|
{#if typeof specpart === "string"}
|
||||||
<span class="inline-flex items-center">
|
<span>
|
||||||
<FromHtml src={Utils.SubstituteKeys(specpart, $tags)} />
|
<FromHtml src={Utils.SubstituteKeys(specpart, $tags)} />
|
||||||
<WeblateLink context={t.context} />
|
<WeblateLink context={t.context} />
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -16,9 +16,11 @@ export class Translation extends BaseUIElement {
|
||||||
throw `Translation without content (${context})`
|
throw `Translation without content (${context})`
|
||||||
}
|
}
|
||||||
this.context = translations["_context"] ?? context
|
this.context = translations["_context"] ?? context
|
||||||
|
|
||||||
if (typeof translations === "string") {
|
if (typeof translations === "string") {
|
||||||
translations = { "*": translations }
|
translations = { "*": translations }
|
||||||
}
|
}
|
||||||
|
|
||||||
let count = 0
|
let count = 0
|
||||||
for (const translationsKey in translations) {
|
for (const translationsKey in translations) {
|
||||||
if (!translations.hasOwnProperty(translationsKey)) {
|
if (!translations.hasOwnProperty(translationsKey)) {
|
||||||
|
|
|
@ -324,7 +324,7 @@ label.checked {
|
||||||
border: 2px solid var(--foreground-color);
|
border: 2px solid var(--foreground-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.links-w-full a {
|
.links-w-full a:not(.weblate-link) {
|
||||||
display: flex;
|
display: flex;
|
||||||
column-gap: 0.25rem;
|
column-gap: 0.25rem;
|
||||||
padding-left: 0.5rem;
|
padding-left: 0.5rem;
|
||||||
|
@ -462,15 +462,18 @@ select:hover {
|
||||||
}
|
}
|
||||||
|
|
||||||
.weblate-link {
|
.weblate-link {
|
||||||
width: fit-content;
|
display: inline-block;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0.25rem;
|
padding: 0.25rem;
|
||||||
|
width: 1.2rem;
|
||||||
|
height: 1.2rem;
|
||||||
border: unset;
|
border: unset;
|
||||||
border-radius: 5rem;
|
border-radius: 5rem;
|
||||||
backdrop-filter: var(--low-interaction-background);
|
backdrop-filter: var(--low-interaction-background);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.no-weblate .weblate-link {
|
.no-weblate .weblate-link {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2150,7 +2150,7 @@ label.checked {
|
||||||
border: 2px solid var(--foreground-color);
|
border: 2px solid var(--foreground-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.links-w-full a {
|
.links-w-full a:not(.weblate-link) {
|
||||||
display: flex;
|
display: flex;
|
||||||
-webkit-column-gap: 0.25rem;
|
-webkit-column-gap: 0.25rem;
|
||||||
column-gap: 0.25rem;
|
column-gap: 0.25rem;
|
||||||
|
@ -2286,12 +2286,12 @@ select:hover {
|
||||||
}
|
}
|
||||||
|
|
||||||
.weblate-link {
|
.weblate-link {
|
||||||
width: -webkit-fit-content;
|
display: inline-block;
|
||||||
width: -moz-fit-content;
|
|
||||||
width: fit-content;
|
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0.25rem;
|
padding: 0.25rem;
|
||||||
|
width: 1.2rem;
|
||||||
|
height: 1.2rem;
|
||||||
border: unset;
|
border: unset;
|
||||||
border-radius: 5rem;
|
border-radius: 5rem;
|
||||||
-webkit-backdrop-filter: var(--low-interaction-background);
|
-webkit-backdrop-filter: var(--low-interaction-background);
|
||||||
|
|
Loading…
Reference in a new issue