Repository navigation
Description
Needs your OK: this lets a participant switch a signup's page, and their own emails, into another language OpenSignup has. It's separate from #619, which shows every participant the signup's language. Swap pipeline:proposed for pipeline:ready to have it built.
What happens
Once #619 ships, participants see a signup in the signup's language. That's right for most people, but mixed audiences include people it doesn't serve: an international school, Swedish-speaking families in Finland, Spanish-speaking parents at a US school. Browser translation helps on the page, but not in the confirmation and reminder emails, which carry the link to change or cancel.
Fix, in outline
- Offer a switch. When the visitor's browser prefers another language in
SHIPPED.participant, show a small link, such as "View in English" or "Visa på svenska", with no script. - The page follows. It renders in the chosen language;
<html lang>follows the reader, and the signup's content keeps its ownlang. - Emails follow too. A
participants.localecolumn records the choice at sign-up, and emails useparticipant.locale ?? signup.locale. - The privacy page says we store it.
Watch for
- How the choice travels. A
?lang=query is the obvious carrier, but the root layout can't readsearchParams. It can read the path-and-query header the middleware sets (Public signup pages always say lang="en", whatever the signup's language #628).- Several places drop the query and need to keep it: the edit and unsubscribe pages rebuild their URL when the slug doesn't match,
commitmentEditUrl, and "Back to the signup". - The sign-up POST must send the chosen
locale. - After sign-up, the stored
participants.localecarries it for emails.
- Several places drop the query and need to keep it: the edit and unsubscribe pages rebuild their URL when the slug doesn't match,
- Budgets. The sign-up route's statement budget (14, or 12 without an email) must not move, so write the language in the participant INSERT or UPDATE the route already does.
- A choice lasts for one signup. Participant rows are per signup; remembering it across signups would need a cookie, which is out of scope.
Choices this makes
- Offer, don't switch automatically. Default: offer. Switching automatically would give every Swede with an English phone English buttons on a Swedish school's page.
Order
After #639, because there's only one language to switch to until Swedish ships.
Done when
- An e2e test: a Swedish signup visited with an English browser shows the link; following it renders English; signing up stores
en; the confirmation email is in English. pnpm lint && pnpm typecheck && pnpm knip && pnpm test,pnpm test:dbandpnpm test:e2epass.
Planned with the owner in https://claude.ai/code/session_01EFKmj716ZY3b3SwR8TV8Y2, where it was split out of #619 as separate work. Checked against the code on main at 35288fa. The localization plan, private to the owner's account: https://claude.ai/artifact/VgQH6U2s2EVx3LX991fJi8 (a Claude session on that account can open it with the Artifact tool's read action).
Activity