Repository navigation
Set the organizer pages' html lang to the organizer's language - #1011
Conversation
The organizer app, sign-in and the AI assistant's consent screen shared one root layout that always said lang="en". They now have one each: /app and /oauth say the organizer's language (localeOfOrganizer, from the session their pages read anyway, so no new statement), and /login says the site default (signInLocale), reading no session, so the check and confirm pages still start no session read. Moving between them is now a full page load, which also brings the right language after signing in or out. Saving the language in account Settings already updates <html lang>: a server action's redirect renders the whole page, root layout included. /login now shares its folder with its root layout, which drops the layout's title template there, so the page writes the site name into its tab title itself, as a signup's page does. Fixes #938. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Tophat: passedRan 4aaf05e locally with
For the owner. Nothing looks different today. Only English has shipped, so every organizer page still says Screenshots are in https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt Generated by Claude Code |
richshaw
left a comment
There was a problem hiding this comment.
Review: passed (round 1)
The PR replaces the one (organizer) root layout with three, so /app and /oauth put the organizer's language on <html lang> (localeOfOrganizer, from the session their pages already read) and /login puts the site default there (signInLocale(), no session). It does what #938 asks, and I found nothing that has to change.
-
The split is the simple way. Each layout is one line of code plus the shared
rootMetadataandrootViewport. One layout that read the session would start a session read on/login/checkand/login/confirm, which #938's "Watch for" rules out. Telling the areas apart by path would mean editingsrc/middleware.ts. No file moved, so the path lists ineslint.config.mjsandno-hard-coded-text.test.tsstill cover everything (the new layouts hold no text). -
<html lang>is right in each case. Signed in with a stored language, signed in with none, signed out (site default once shipped, elseen), and the e2e run's unshipped languages all go throughlocaleOfOrganizer, the same function the screens use, so the attribute can't disagree with the text.root-layouts.test.tsxcovers each case for the app and consent layouts, and that the sign-in layout callsgetOrganizerSessionzero times. -
Full page loads. The moves that now cross a root layout are
SessionWatcher'srouter.replaceon/login/check, the redirect to/login?callbackUrl=…fromrequireOrganizerSessionand from the consent page, sign-out to/login, and the consent screen's two<Link>s to/appand/app/settings/connected-apps. Next turns each into a full load. Code redemption already usedwindow.location.assign, the magic link was already a top-level navigation, and the send-link action's move from/loginto/login/checkstays inside the sign-in layout. NocallbackUrlhandling changed. -
/login's tab title.{ absolute:${t('tabTitle')} · ${INSTANCE_NAME}}gives the same string the template%s · ${INSTANCE_NAME}gave. It's the only edit to an existing file underlogin/, and it's metadata only./login/check,/login/confirm,(chrome)/page.tsxand the consent page sit below their layouts, so they keep the template. - Issue outline. Every "Fix" and "Done when" item is done. The one departure is explained and tested: saving the language needs no forced reload, because the action's redirect renders the root layout again.
Blocking (0): none.
Optional (2):
src/app/(organizer)/app/layout.tsxandsrc/app/(organizer)/oauth/layout.tsxare the same code under different comments. A(organizer)/(signed-in)/group holding both would make it one file and keep the consent screen's links to/appclient-side, but it moves two folders and every path list with them. Not worth it now.- The tab title's
· ${INSTANCE_NAME}is now written in three places:root-shell.tsx's template,tabTitleinsrc/app/s/[slug]/page.tsx:31andsrc/app/(organizer)/login/page.tsx:29. One exported helper besiderootMetadatawould stop them drifting.
Earlier threads: none. Copilot answered that it couldn't review (quota).
Checks: CI is green on 4aaf05e (lint-type-test, e2e, CodeQL). Locally on 4aaf05e: pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test passed (240 files, 3438 tests); pnpm test:db passed on a fresh migrated database (47 files, 857 tests); pnpm build && pnpm budgets passed, with /login at 109.1 kB of 110 and no budget changed. The tophat passed on this same commit, so no runtime code has changed since.
Gate: owner. Two reasons. It's a UX change (pipeline:ux): moving between the organizer app, sign-in and the consent screen is now a full page load, and once a second language ships these pages announce it. And it edits src/app/(organizer)/login/page.tsx, a sign-in path, which #938's own gate sends to the owner. There is no pipeline-owner-approved marker on this PR, so the review doesn't assume one. Worth a look: the tophat's 1011-before-sv-desktop-app and 1011-after-sv-desktop-app, and its navigation row (sign-in tab moving on, sign-out, the consent screen's Connected apps link).
https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Generated by Claude Code
|
The owner approved building and merging this with the rest of the launch work under #619, in the orchestrating session on 16 November 2026: "Build #938, the participant The tophat (6923578922) and the review (5924356797) both passed on 4aaf05e. Next I bring the branch up to date with https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt Generated by Claude Code |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Fixes #938.
The problem
The organizer app (
/app), sign-in (/login) and the AI assistant's consent screen (/oauth) shared one root layout,src/app/(organizer)/layout.tsx, which always rendered<html lang="en">. Once an organizer's screens are in their own language, the page would still tell screen readers and browser translation it's English. The layout's comment about #619 was out of date too.The fix
How the layout chooses. The one root layout becomes three, one per area, each choosing the language its pages' text is already in:
<html lang>(organizer)/app/layout.tsxlocaleOfOrganizer(session): the organizer's stored language, else the site default, else EnglishgetOrganizerSession(), which every/apppage already reads (cached per request)(organizer)/oauth/layout.tsx(organizer)/login/layout.tsxsignInLocale(): the site default, else EnglishThe e2e run's
E2E_UNSHIPPED_LOCALESis honoured throughlocaleOfOrganizer, as the screens do.Why split the layout, rather than one layout that looks at the request. A root layout can't see its path. The other ways to tell
/loginfrom/oauthwere all worse:/login/checkand/login/confirm(with a cookie), which read none today;ORGANIZER_CALLBACK_HEADERonly covers/app, so it can't tell/loginfrom/oauthwithout changingsrc/middleware.ts.Splitting needs no change to
src/middleware.tsorsrc/auth/, and no file moves: three small layout files replace one.Statements. None added.
/appand/oauthpages already callgetOrganizerSession()(throughrequireOrganizerSessionor directly), and it's wrapped in Reactcache(), so the layout shares the page's read. The sign-in layout callssignInLocale(), which reads only the environment. A unit test checks that the sign-in layout never callsgetOrganizerSession.Keeping it current.
<html lang>in place. SosetOrganizerLocaleActionalready ends with the newlangand no reload, and I added no forced reload. To check it, I shippedsvlocally (not committed) and saved Svenska, then English, in account Settings.<html lang>wenten→sv→en, and a marker onwindowsurvived, so the page never reloaded./login/check'sSessionWatcherusesrouter.replace, which used to stay inside the shared layout. Now it crosses into another root layout, so the whole page loads. The new e2e test covers this./, a different root layout, so it was already a full load. From the consent screen's "switch account" and from the card for a signup that can't be loaded, it goes to/login, which now crosses root layouts too.A side effect, fixed here.
/login/page.tsxnow sits in the same folder as its root layout, and Next doesn't apply a layout's title template to a page in that folder. So the page writes the site name into its tab title itself (title: { absolute: … }), the ways/[slug]/page.tsxalready does. The tab still reads "Sign in · OpenSignup". This is the one edit undersrc/app/(organizer)/login/: a metadata change, nothing about sign-in itself.Also: comments that said "three root layouts" (
root-shell.tsx,global-not-found.tsx,next.config.mjs,root-layouts.spec.ts), CLAUDE.md's Routes paragraph, and the signup header layout's note that cited #938 for a "full page load". There's also a CHANGELOG entry. Nothing changes for anyone while only English ships: every page still saysen.Where the issue was out of date. It was written before #898 and the locale helpers landed. The helper is
localeOfOrganizer, the sign-in pages usesignInLocale()rather thandefaultFor(…), and saving the language didn't need a forced full load (above).Tests
src/app/(organizer)/root-layouts.test.tsx. For each non-English catalog language, it covers the app and consent layouts: signed in with a stored language, signed in with none, signed out with and without a site default, English while unshipped, and anE2E_UNSHIPPED_LOCALESlanguage kept. For the sign-in layout it covers: the site default whoever is signed in, English while unshipped, and no session read. As a check, I swapped the consent layout tosignInLocale()and the test failed.organizer-language.spec.ts:E2E_UNSHIPPED_LOCALES=sv) gets<html lang="sv">on/app. Signed in,/login/checksaysen, the site default. Moving on to/apploads the whole page insv;<html lang>;sign-in-text.spec.tschecks<html lang="en">on/login, check and confirm.organizer-language-story.spec.tschecks it on Your signups, and after saving the language once one ships.Commands run, all passing:
pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test: 240 files, 3438 tests.pnpm test:db: 47 files, 857 tests, includingquery-budget.db.test.ts.pnpm build && pnpm budgets: no page over budget. The layouts are server components, so there's no client JavaScript in them.pnpm test:e2e --project=chromiumonorganizer-language,organizer-language-story,sign-in-text,oauth-consent,a11y,root-layouts,login-formandlogin-code: 60 passed. The 2 skips are Magic Compose's questions, which skip with noLLM_BASE_URL.organizer-languagetests at phone width (Pixel 7 in Chromium; there's no WebKit here): 6 passed.svshipped locally (not committed), the story spec's new checks after Save passed. The run then timed out further on, at a dev-server compile.Repeated runs tripped the per-IP OAuth limit once; I cleared
rate_limitsin my own test database and reran.🤖 Generated with Claude Code
https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt