Every template and handler message in internal/web goes through a JSON
catalogue under internal/web/locales/<code>/, with English as the fallback.
The language is the person's choice (a cookie set by /_lang/{code}), else
Accept-Language, else landing.language. Tests refuse a key some language
lacks, a translation with other arguments than English, and template text
left in English.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
10 lines
606 B
HTML
10 lines
606 B
HTML
{{/* The language switcher at the foot of every page: each language by its
|
|
own name, so someone looking for Türkçe finds that word, and the one in
|
|
use marked rather than offered. A plain link, so it works without a
|
|
script; /_lang remembers the choice and comes back here. */}}
|
|
{{define "langs"}}<nav class="langs" aria-label="{{t "lang.switch"}}">
|
|
{{- range $i, $l := languages}}{{if $i}} · {{end}}
|
|
{{- if eq $l.Code lang}}<b lang="{{$l.Code}}">{{$l.Name}}</b>
|
|
{{- else}}<a href="/_lang/{{$l.Code}}" hreflang="{{$l.Code}}" lang="{{$l.Code}}">{{$l.Name}}</a>{{end}}
|
|
{{- end}}</nav>{{end}}
|