hackertours/layouts/_shortcodes/lang.html
Stefan Bethke 5c1b60fa3a
All checks were successful
/ build (pull_request) Successful in 32s
/ cleanup-staging (pull_request) Successful in 3s
Upgrade to Hugo 0.16x and zen theme v7.1.0
- Bump themes/zen from v5.7.0 to v7.1.0 (vanilla CSS, no libsass).
- Move layouts to Hugo's new template structure (_default -> root,
  index.html -> home.html, shortcodes -> _shortcodes).
- Replace deprecated language API in templates (Locale, Direction, Name)
  and sync base templates and mobile menu with theme v7.
- Config: languageName/languageCode -> label/locale; move copyright to
  the top-level key the v7 footer reads.
- Port _custom.scss to assets/css/_custom.css and map page/body
  backgrounds to v7's --color-body-bg/--color-page-bg.
- CI: build with hugomods/hugo:0.165.0.
2026-10-16 15:07:25 +02:00

16 lines
No EOL
1 KiB
HTML

{{- $code := .Get 0 | 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" "")) -}}
{{- $title := "" -}}
{{- 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)" -}}
{{- 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" -}}
{{- 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 -}}
<abbr style="font-size: .65em; vertical-align: super;" title="{{ $title }}">{{ $label }}</abbr>
{{- end -}}