Forgejo footer links send English users to the Swedish portal pages #334

Stängd
öppnade 2026-08-02 12:30:48 +00:00 av supernaut · 0 kommentarer
Ägare

Separately from the label language: the footer links point at the portal's Swedish
URLs unconditionally. The website serves Swedish at / and English under /en/, so a reader
using Forgejo in English who clicks "Privacy Policy" gets the Swedish "Integritetspolicy" page.

curl -s -H 'Accept-Language: en-US' https://www.gitborg.se/terms    # 200, <html lang="sv">
curl -s                             https://www.gitborg.se/en/terms # 200, Terms of Service

The website does not detect Accept-Language — Astro is configured with
defaultLocale: "sv" and redirectToDefaultLocale: false, and there is no locale middleware —
so the /en prefix has to be built by whoever emits the link. The comment at the top of
ansible/roles/forgejo/templates/custom/extra_links_footer.tmpl.j2 claims the legal pages do
their own English detection; they do not, and that comment should go with the fix.

Fix

In the same fragment, derive the path prefix from the Forgejo UI language:
sv-SE → no prefix, anything else → /en. Applies to all three links, including the bare
gitborg.se link, whose label stays as it is (a hostname, not translatable text).

Honouring the language the reader explicitly selected in Forgejo is better than header
sniffing, and it works without any change to the website.

Done when

  • English UI links resolve to /en/, /en/terms, /en/privacy (all 200).
  • Swedish UI links are unchanged.

Part of gitborg/gitborg-docs#70.

Separately from the label language: the footer links point at the portal's Swedish URLs unconditionally. The website serves Swedish at `/` and English under `/en/`, so a reader using Forgejo in English who clicks "Privacy Policy" gets the Swedish "Integritetspolicy" page. ``` curl -s -H 'Accept-Language: en-US' https://www.gitborg.se/terms # 200, <html lang="sv"> curl -s https://www.gitborg.se/en/terms # 200, Terms of Service ``` The website does not detect `Accept-Language` — Astro is configured with `defaultLocale: "sv"` and `redirectToDefaultLocale: false`, and there is no locale middleware — so the `/en` prefix has to be built by whoever emits the link. The comment at the top of `ansible/roles/forgejo/templates/custom/extra_links_footer.tmpl.j2` claims the legal pages do their own English detection; they do not, and that comment should go with the fix. **Fix** In the same fragment, derive the path prefix from the Forgejo UI language: `sv-SE` → no prefix, anything else → `/en`. Applies to all three links, including the bare `gitborg.se` link, whose label stays as it is (a hostname, not translatable text). Honouring the language the reader explicitly selected in Forgejo is better than header sniffing, and it works without any change to the website. **Done when** - English UI links resolve to `/en/`, `/en/terms`, `/en/privacy` (all `200`). - Swedish UI links are unchanged. Part of gitborg/gitborg-docs#70.
Logga in för att delta i denna konversation.
Ingen milstolpe
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-infra#334
Ingen beskrivning angiven.