fix(forgejo): make the footer links follow the reader's language, in label and destination #343
Inga granskare
Etiketter
Inga etiketter
area/backups
area/ci
area/control-panel
area/identity
area/infra
area/observability
area/payments
area/security
area/storage
area/web
blocked
needs-info
needs-triage
ready-for-implementation
type
bug
type
chore
type
docs
type
epic
type
feature
type
task
wontfix
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Inget förfallodatum satt.
Beroenden
Inga beroenden satta
Referens
bitborg/bitborg-infra!343
Läser in…
Hänvisa till i nytt ärende
Ingen beskrivning angiven.
Ta bort grenen "fix/forgejo-footer-i18n"
Borttagning av en gren är permanent. Även om den borttagna grenen kan fortsätta existera en kort tid innan den faktiskt tas bort, kan det INTE ångras i de flesta fall. Vill du fortsätta?
Closes #333, closes #334.
Both are our own defects, not upstream translation gaps.
#333 — the three portal links in the footer render in Swedish whatever the interface language.
custom/templates/custom/*hook fragments are not routed through the translation pipeline unlessthey ask for it, and ours was plain HTML with hardcoded labels. Verified by diffing the
en-USandsv-SEresponses: those lines were byte-identical while the upstream strings beside them("Powered by Forgejo", "Licenses") translated correctly.
#334 — separately, all three pointed at the portal's Swedish URLs unconditionally. The site
serves Swedish at
/and English under/en/and does noAccept-Languagedetection, so an Englishreader clicking "Privacy Policy" landed on the Swedish page even once the label was fixed.
Both are fixed in the same fragment by branching on
ctx.Locale.Lang, which the application injectsper request into every template including
custom/*hooks. The stale comment claiming the legalpages detect English themselves is removed — they do not, and it is what caused #334.
A trap worth recording, now in the fragment's comment: do not add translation keys under
custom/options/locale/. Locale files are read through a layered asset filesystem whoseReadFilereturns the first matching layer and stops, so a custom
locale_en-US.iniwould replace the entirebuilt-in English locale rather than extend it.
Rendered output
Swedish output is byte-identical to production, proven rather than asserted: the whole footer
region was extracted from the live
sv-SEpage and from a local render and compared — identical,including the leading newlines, which survive because comments are stripped as nodes rather than
lines.
Two details checked while in there: an explicitly chosen language wins over header sniffing (with a
sv-SEheader plus the switcher'sen-UScookie, the footer renders English); and{{$portal}}sits in the path part of the
href, so the normaliser rather than the escaper applies and/enstays
/en.Verification
Rendered and served through the local podman preview.
ansible-playbook site.yml --syntax-checkclean,
ansible-lint0 failures across 191 files, Prettier and markdownlint clean, gitleaks cleanover 264 commits.
46568abe451584aee6981584aee698cd6ce47f45cd6ce47f4584bac4d01b84bac4d01bd71b95ea98d71b95ea9804f934234704f9342347bec37e477b