Merge branch 'main' into 40c3
This commit is contained in:
commit
925737eff5
16 changed files with 206 additions and 28 deletions
|
|
@ -1,21 +1,25 @@
|
|||
{{- /* Language badge for a tour. Params: code ("de", "en" or "deen"), class (optional; without it the badge is styled as an inline superscript). */ -}}
|
||||
{{- /* Language badge for a tour. Params: code ("de", "en" or "deen"), class (optional; without it the badge is styled as an inline superscript).
|
||||
The visible label ("DE/EN") is hidden from screen readers, which read a short text instead; the full sentence is a tooltip. */ -}}
|
||||
{{- $code := .code | lower -}}
|
||||
{{- $validCodes := slice "de" "en" "deen" -}}
|
||||
{{- if not (in $validCodes $code) -}}
|
||||
<span style="color: red; font-weight: bold;">Warning: Invalid or missing language code '{{ $code }}'. Use 'de', 'en', or 'deen'.</span>
|
||||
{{- else -}}
|
||||
{{- $label := cond (eq $code "de") "DE" (cond (eq $code "en") "EN" (cond (eq $code "deen") "DE/EN" "")) -}}
|
||||
{{- $de := eq site.Language.Name "de" -}}
|
||||
{{- $label := cond (eq $code "de") "DE" (cond (eq $code "en") "EN" "DE/EN") -}}
|
||||
{{- $title := "" -}}
|
||||
{{- $spoken := "" -}}
|
||||
{{- if eq $code "deen" -}}
|
||||
{{- $title = cond (eq site.Language.Name "de") "Diese Tour wird zweisprachig stattfinden (Deutsch und Englisch)" "This tour will be bilingual (German and English)" -}}
|
||||
{{- $title = cond $de "Diese Tour wird zweisprachig stattfinden (Deutsch und Englisch)" "This tour will be bilingual (German and English)" -}}
|
||||
{{- $spoken = cond $de "Sprache: Deutsch und Englisch" "Language: German and English" -}}
|
||||
{{- else if eq $code "de" -}}
|
||||
{{- $title = cond (eq site.Language.Name "de") "Diese Tour wird auf Deutsch stattfinden" "This tour will be held in German" -}}
|
||||
{{- $title = cond $de "Diese Tour wird auf Deutsch stattfinden" "This tour will be held in German" -}}
|
||||
{{- $spoken = cond $de "Sprache: Deutsch" "Language: German" -}}
|
||||
{{- else if eq $code "en" -}}
|
||||
{{- $title = cond (eq site.Language.Name "de") "Diese Tour wird auf Englisch stattfinden" "This tour will be held in English" -}}
|
||||
{{- end -}}
|
||||
{{- with .class -}}
|
||||
<abbr class="{{ . }}" title="{{ $title }}">{{ $label }}</abbr>
|
||||
{{- else -}}
|
||||
<abbr style="font-size: .65em; vertical-align: super;" title="{{ $title }}">{{ $label }}</abbr>
|
||||
{{- $title = cond $de "Diese Tour wird auf Englisch stattfinden" "This tour will be held in English" -}}
|
||||
{{- $spoken = cond $de "Sprache: Englisch" "Language: English" -}}
|
||||
{{- end -}}
|
||||
{{- $style := "font-size: .65em; vertical-align: super;" -}}
|
||||
{{- with .class }}{{ $style = "" }}{{ end -}}
|
||||
<span{{ with .class }} class="{{ . }}"{{ end }}{{ with $style }} style="{{ . | safeCSS }}"{{ end }} title="{{ $title }}"><span aria-hidden="true">{{ $label }}</span><span class="visually-hidden">{{ $spoken }}</span></span>
|
||||
{{- end -}}
|
||||
|
|
|
|||
Loading…
Reference in a new issue