Repository navigation
Run the translation tests for every language with a catalog - #935
Conversation
Part of #620: the core. next-intl and use-intl 4.14.9, pinned together (icu-minify too, through an override), with next.config.mjs wrapped in next-intl's plugin. src/messages/en.json is the English catalog, and next-intl's AppConfig is typed from it, through the declaration the plugin writes, so a missing key or a wrong argument fails typecheck. src/i18n holds the pure locale config (CATALOG_LOCALES, SHIPPED), a synchronous translator on use-intl/core with English filled in under any other language, the server wrapper that logs what goes wrong, the request config the plugin needs, and an English translator for tests that throws. The site footer's labels are the first text in the catalog, so the translator is proven in a server component, on static and dynamic pages. A new check runs it under the worker's toolchain. No page's first-load JavaScript changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
A local ESLint plugin in eslint.config.mjs, with one rule so far: opensignup/no-catalogs-in-client. In a file that opens with a 'use client' directive, it reports any import of a catalog in src/messages, or of the translators that load every catalog (src/i18n/translator.ts, server.ts and testing/translator.ts), since either would put that text in the browser's JavaScript. It reads the directive rather than matching paths, follows @/ and relative paths, re-exports, import(), require() and import paths built from a template, and lets type-only imports through, since those are compiled away. The message says why and what to do instead. The tests lint fixtures through the repo's own config, so they also prove the rule is on for the app's files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
A unit test over src/messages/ checks every catalog against en.json: completeness per namespace, enforced for each language in SHIPPED for the namespaces its audience reads; every message compiles with icu-minify; placeholders, tags and select branches match English, and each placeholder takes the value English is passed; no key English lacks; and no English message the app doesn't use. Which keys the app uses comes from the type checker: a call whose signature is use-intl's Translator, its namespace from the keys it accepts, its key from the type of its argument, so helpers, props, aliases and typed tables are all seen, and a key or namespace it can't read fails the check. The audience namespaces move from a comment to AUDIENCE_NAMESPACES in src/i18n/config.ts. src/types/next-intl.d.ts imports next-intl, because an augmentation alone doesn't load its module: without it, code with no test importing next-intl typed every message key as a plain string. icu-minify is a devDependency at exactly 4.14.9, the version next-intl and use-intl resolve, and the pnpm override now points at it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Two rules, on only for the files and folders listed in TRANSLATED in eslint.config.mjs, which so far is the site footer: - react/jsx-no-literals with noStrings and ignoreProps, for JSX text; - opensignup/no-literal-text-props, a local rule for a string on aria-label, aria-description, title, placeholder, alt or label. noAttributeStrings would also flag every className and href. TRANSLATED takes paths as they are on disk. filesAt escapes them for the config's globs, since an unescaped src/app/s/[slug]/** matches src/app/s/s/ and not the [slug] folder, and stops lint when a path doesn't exist. The footer's license line is exempt with a comment. Also, from #891's review: no-catalogs-in-client follows a + chain that starts with a string, as it does a template, and denies every module in src/i18n/ to client files except those in CLIENT_SAFE_I18N (config), rather than listing the modules that load catalogs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
A translation that kept a select's argument but dropped the select
(`Status: {status}` for English's `{status, select, open {Open} ...}`)
passed, and would show participants the code's value. The check now
reports `{status} isn't a select here, but is in English`.
From the same review:
- The check's program types translators against the en.json it just
loaded, written over src/messages/en.d.json.ts, so a stale declaration
no longer gives misleading lines. findUsedKeys now builds the program
itself, and the fallback for a stale declaration is gone, with its edge
case that could pick the wrong section. messages-declaration.test.ts
still fails on a stale file.
- Code in any `testing` folder and in src/mcp/evals doesn't count as a use.
- `t?.('key')` is seen.
- A test for the dot-in-key check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Turn on next-intl's experimental message precompiling, so the first
client component with translated text ships a small formatter instead of
use-intl's ICU parser: measured here at 3,470 bytes gzipped against
12,353 without it.
Under precompile the plugin's loader compiles every catalog the Next
build imports, the server's too, and a message with an argument, plural
or tag becomes an array. withEnglishUnder treated every object as a
section and went into those arrays, so each such message would have
rendered as its key path in the web process while vitest and the worker,
which read the raw JSON, stayed green. A message is now a string or an
array, and only a section is merged into.
The footer's "{INSTANCE_NAME} · AGPL-3.0" line becomes a message with an
argument, the first the app has, and a production-build e2e checks it on
a prerendered page, a page rendered per request and the public signup
page. A unit test runs next-intl's own loader over every catalog and
checks each message formats the same precompiled as from the raw JSON.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
…ext-lint Brings in #892's review fixes (a7a10ed) so this PR stays on top of #892's final state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
formatSlotDate and formatSlotTime now take the reader's language as a
required `locale`, and so does everything that prints a slot's values:
renderFieldValue, slotDetails, summarizeSlotValues, formatGroupLabel,
buildMetaSegments, prettyHeader, and the two commitment services that name a
slot for the edit and cancelled pages. Every caller passes 'en' for now, so
nothing anyone sees changes.
A date is built from its parts as a UTC moment and formatted in UTC, so no
zone can move it to another day. English keeps today's output exactly,
including the hand-written 12-hour clock with its no-break space before
AM/PM; other languages get Intl's own ("lör 3 maj", "18:30" in Swedish).
formatSlotDate now formats only a stored YYYY-MM-DD. It used to fall back to
`new Date()` for any other string, in the host's zone; no caller relied on
that, as both checked isRealDate first.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
filesAt escaped the characters a glob reads specially but not the backslash it escapes them with, so a listed folder named `a\b` became the glob `a\b/**`, which matches `ab/` and not `a\b/`. The backslash is now escaped in the same pass as the rest. filesAt takes an optional root so a test can list a real folder with a backslash in its name, made in a temporary directory, and check the glob with ESLint's own matcher. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
…mpile Brings in #893's later commits (#892's final code, main, and the filesAt escaping fix) so this PR stays on top of #893. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
…-format Keeps this PR on top of #894's current branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
main now holds #893 (7a9fada), whose final code this branch already had. The only conflict was the footer line #893 exempted from lint and this PR turns into a message; this branch's version is kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
…-format Keeps this PR on top of #894's current branch, which now has main (#893) merged in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Every formatter that named a language now takes the reader's as `locale`, and every caller passes 'en' for now, so English reads exactly as before: - format-duration: `formatDuration` and `waitInMinutes` write each amount with Intl (number, unit and plural), so "1 minute" and "2 timmar" both come out right. `locale` defaults to English, since some callers are sign-in and OAuth code that gets a language with its own text. - fit-text: Magic Compose's cut-off warning writes its limit with Intl.NumberFormat. - connected apps: the approval, last-use and expiry dates go through `formatGrantDate`, which keeps English in the day-first order the page has always shown. - Magic Compose: `formatOneDay`, `appendAnswers` and `timeLength` take a locale, and `MagicComposeRoot` passes one down to Compose (the character count), Questions, Drafting and DraftingFrom. English times keep "9am"; other languages get Intl's short time, as slot times do. The participant rate-limit message now writes its plural in its own sentence from `waitMinutes`, as Magic Compose's hourly-limit message does, so the plural moves into the catalog with the sentence and Intl's unit code stays out of the participant pages, which had 5 bytes of budget left. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
…er-formatters Keeps this PR on top of #895's current branch, which now has main (#893, #894) merged in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
…le change Part of #625. A signup can now hold a language in settings.locale, and an operator can set DEFAULT_LOCALE. Nothing reads either yet, so pages, emails and the AI connector's tools are unchanged. - settings.locale is a lenient string, so a stored language that has left the list still parses. createSignup and updateSignup refuse a language the caller sends unless it has shipped to participants; updateSignup checks only a sent one, as it does for groupByFieldRefs, because it merges the stored settings under the patch before parsing. - resolveLocale and defaultFor in src/i18n/config.ts, pure, with isShipped. - DEFAULT_LOCALE in src/lib/env.ts, an optional enum of the catalog languages. - locale joins UNREAD_SETTINGS, so update_signup refuses it and get_signup hides it until something reads it. - .env.example, fly.example.toml, the README and the CHANGELOG say what it does, that it changes nothing until a second language ships, and where a runtime variable goes on each platform. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
…anguage ships The Settings tab gets a "Signup language" form, a plain form like "Ask for an email address" with no script of its own. It renders only once a second language has shipped to participants, so nothing shows yet. Each language is named in itself (English, Svenska), through Intl.DisplayNames. Saving sends only `locale` through updateSignup, which refuses a language that hasn't shipped; a refusal shows the tab's usual error. A signup with no language of its own shows the instance's, so instanceDefaultLocale() comes in here with its first caller. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
TIME_ZONE moves from src/i18n/config.ts to its own src/i18n/time-zone.ts. Browser code reaches it through src/lib/slot-label.ts (the Build tab's time picker and Magic Compose), which made config.ts part of the code those two share. Webpack counts a module's unused code when it decides whether shared code gets a chunk of its own, so the language rules this branch added to config.ts tipped it into making one. That chunk's entry in the webpack runtime added 29 to 47 bytes to every page and pushed /s/[slug]/c/[id] over its 110 kB budget. With config.ts out of the browser's graph, every page's JavaScript is byte-for-byte the size it was on the base branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
…sent A settings.locale longer than 35 characters (or not a string), written straight into the database, failed the whole settings parse: the signup asked for an email the organizer had turned off, and every settings save failed on a field nobody sent. The schema now reads such a value as no language (.catch(undefined)), so a stored value can never break the row, and an unrelated save drops it. createSignup and updateSignup check the raw value the caller sends instead of the parsed one, so a too-long, non-string or unknown language is still refused with invalid_input on settings.locale (now with the service's own message, where a too-long one used to get zod's). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
The README, .env.example and CHANGELOG said a language "takes effect only once OpenSignup ships it", with a Swedish school as the example, which reads as "set sv now and it will start working later". In fact any value but en stops the app: the worker exits at startup and every page that needs the database fails with an "Invalid environment" error. They now say that, tell operators to leave it unset for now, drop the example, and put what an unset value means in the future tense, since nothing reads an organizer's browser language yet. fly.example.toml says the same in one line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
In a file of its own, the form was a second server module importing AsyncSubmitButton, and webpack then added a few bytes to that button's module on every page that loads it. Inline in page.tsx, every page's first-load JavaScript is byte-identical to the base. The test now renders the Settings tab itself, so it also checks the page shows the form, and that "Saved" appears only by the form that saved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
#896 merged, so main now holds this branch's base. The one conflict, src/lib/slot-label.ts, is between #895 and #896 as squashed on main and the same commits in this branch's history; main's copy equals #896's head, so the branch's copy (with TIME_ZONE from its new module) stands. The merged tree is identical to the branch's before the merge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
…ettings-control Takes #897's address round: TIME_ZONE out of config.ts, the lenient read of a stored locale, and the docs on DEFAULT_LOCALE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
chooseOrganizerLocale takes the organizer's saved language, the instance's DEFAULT_LOCALE and the browser's Accept-Language header (null where there is no browser, as for MCP) and returns the first that has shipped to the audience asked about, else English, with the step that chose it. Only the browser's top-ranked range counts, so "sv,en;q=0.8" gives English until Swedish ships rather than settling for the second choice. It lives in its own file, away from server.ts (which the worker imports) and from next/headers. The column, the session field and the request wrapper come later. Part of #626. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
getSignupRowBySlug reads the live signup at a slug in one statement, skipping deleted rows and keeping drafts and archived ones, so the page can still say which. getPublicSignup takes that row, or a slug as before for the public API, and loadPublicSignup now gets its row from the new cached loadSignupRowBySlug. A layout that reads the row too (a later part of #628) then adds no statement to GET /s/[slug]. A unit test stands a per-request cache in for React's and checks the page's read goes through loadSignupRowBySlug and hands getPublicSignup the row, not the slug. The query-budget test says why it counts the page alone. Both page budgets stay at 5 and 6. Part of #628. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Tophat: passedI ran 07c9b0d and
A fake second languageI followed step 1 of "Adding a language": copied
UX: no. Nothing a person sees changes. The pages, the emails and the screenshots match 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: changes needed (round 2)
The PR makes every catalog language but English a test language and runs the participant specs, seed, screenshots and email samples once for each, with expected text from the language's catalog. The move is faithful, with one exception: the no-English check can now switch itself off. That needs fixing before this merges, because #952 builds on it.
Blocking (1):
tests/e2e/translated-signup.spec.ts:67(englishLeftIn): a message left in English in a language's catalog removes its words from that language's no-English pattern. A Swedish page that fails onmainpasses here. Proof and fix are in the inline comment.
Optional (3):
tests/e2e/translated-signup.spec.ts:108(expectNoEnglish), the same onmain, so not this PR's: the pattern runs ontextContent, which joins neighbouring elements with no space, so\bmisses a word at the start or end of an element. With the edit page's title set to "Your spot",mainand this branch both pass, because the text reads…anmälningslistanYour spotRäksmörgås…. Since the fix round is in this function anyway,toHaveText(pattern, { useInnerText: true })may be enough; check it doesn't fail on something real first.tests/e2e/build-tab-language.spec.ts:93: the expected group order was the literalApa, Zebra, Äpple, Ödlaand is nowlocaleCompare(…, locale)in the test's own Node, the same call the tab makes. The browser-against-server check is kept, andBuildWysiwyg.test.tsx:265still pins the Swedish order, so nothing is lost today. The PR body's table doesn't mention it; a line there would help.tests/e2e/helpers/languages.ts:83(matching):\d+became\p{Nd}+. That's right for languages with other digits and makes no difference for Swedish.
What I compared, and found kept:
main'sswedish-signup.spec.tsagainsttranslated-signup.spec.ts, test by test: 27 tests in 5 blocks, 88expect(in each, the same assertions in the same order. #1012's checks are all there:expectSignupLayoutIn(page, locale)(<html lang>,og:locale, the footer) on the open page, and the six "around what they show" tests with their statuses (200 and the 404). The strip, the Preview banner, the tip's accessible description and itslang="en"are unchanged.- Literals that became catalog text read the same key the page reads:
Anmäl dig(dialog.signUp),Fullt(signupView.full),Ditt namn(fields.name, which the edit form's label uses),NamnlösandAlternativ 1(participant.defaults). The Sign up button's pattern is now anchored at both ends, which is stricter.Saftin the "filled up" answer isslots.one, stillSaftfor Swedish. - The email samples' Swedish literals became catalog text through a translator that falls back to English. That's the round 1 point, now stated in the comments, and
catalogs.test.tscovers Swedish. - Browser-guess tests: against
mainno test is removed.chooseOrganizerLocaleis nowhere onmainor here.newOrganizerLocaleis still tested inorganizer-locale.test.tsandconfig.test.ts, neither of which this PR touches. Every changed unit and DB title is a rename from "Swedish" toOTHER_LANGUAGE, or a list that now comes fromCATALOG_LOCALES. - No hidden
sv: the five per-language specs andhelpers/languages.tsname Swedish only in comments. Swedish text lives inORGANIZER_TEXT,SAMPLE_TEXTandKEEP_IT_PRIVATE. E2E_UNSHIPPED_LOCALES: set only inplaywright.config.ts'swebServer.env. Nothing inDockerfile, the compose files,.env.exampleor the workflows names it.tests/e2e/helpers/unshipped-locales.tsismain's, unchanged.- Docs:
docs/translating.md, thetranslateskill and CLAUDE.md nametranslated-signup.spec.ts,TEST_LOCALES,OTHER_LOCALEand the two tables correctly. The fix adds a third table to that list. - Run time: the test list is the same as
main's with one test language, so CI's e2e job is unchanged (about 5½ minutes on this SHA). Locally the five per-language specs ran 74 chromium tests in 1.0 minute with 2 workers, 54 of them Swedish's. A further language adds about 70 chromium tests (the tophat's count), roughly a minute or two on CI. That's reasonable. - No personal data, no real addresses, no model names. No leftovers of
swedish-signup,makeSwedish*,gotoSwedish,helpers/swedish,seed.swedishorUNSHIPPED_TEST_LOCALES.
Earlier threads: none open. Round 1's five optional points are all dealt with. Copilot answered that it couldn't review (quota).
Checks: CI is green on 07c9b0d (lint-type-test, e2e, CodeQL). Locally on 07c9b0d, on a database of my own:
pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test: pass (242 files, 3454 passed and 1 expected fail).pnpm test:db: pass (47 files, 857 tests).- e2e on a production build, chromium:
translated-signup27,a11y12,build-tab-language12,slot-row-layout14,precompiled-messages9. All 74 passed.
The tophat passed on this SHA (ux=no), and no runtime code changed since.
Gate: auto. Only tests, test helpers, scripts, docs and comments change. The test files under src/auth, src/oauth and src/app/api/mcp only swap the literal 'sv' for OTHER_LOCALE. The fix is test-only, so the PR can go straight back to review.
https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Generated by Claude Code
The no-English check took a word out of a language's pattern whenever that language's own catalog wrote it, so a message left in English in the catalog switched the check off on the very page it should catch. Now SHARED_WITH_ENGLISH lists, by language, the words of ENGLISH_WORDS a language really writes as its own (none for Swedish), and only those leave the pattern. The catalog scan stays, only to word the failure: it names the messages that write the English words found. The check also runs on innerText as well as textContent: textContent runs one element's text into the next, so a word at an element's edge slipped past the word boundary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
|
Back to review with 8321c30. The blocking point is fixed; the proof is in its thread. The fix changes only the spec and docs, so the 07c9b0d tophat still stands. The optional points in review 5925480054:
Checks on 8321c30:
The PR body's "The fix", "Review round 2" and "Tests" sections say the same. https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt Generated by Claude Code |
richshaw
left a comment
There was a problem hiding this comment.
Review: passed (round 3)
The PR makes every catalog language but English a test language and runs the participant specs, seed, screenshots and email samples once for each. Round 2's one blocking point is fixed in 8321c30: the no-English check no longer works its word list out from the language's own catalog, so a message left in English can't switch it off.
Blocking (0)
Optional (0)
What I checked on 8321c30:
- The fix holds.
englishLeftInreads onlySHARED_WITH_ENGLISH, whose type accepts only words fromENGLISH_WORDS. Swedish's entry is empty, so its pattern ismain's 16 words. I repeated round 2's proof: withparticipant.gonePage.editLink.bodyinsv.jsonset to its English and a fresh production build, "says a broken edit link isn’t working, in Swedish, with a 404" fails, on the pattern/\b(Your|You|…|link|Sorry)\b/. Withsv.jsonreverted and rebuilt, it passes. - The failure names the message. It is headed:
English on the page. sv.json writes it in participant.gonePage.editLink.body ("Your", "spot", "link"): translate each message, or add a word Swedish says too to SHARED_WITH_ENGLISH in this spec. The catalog scan (englishInCatalog) feeds only that text. On a clean catalog it finds nothing and the failure would be Playwright's own. - The
innerTextcheck is added after thetextContentcheck, which stays, so it can only catch more. On a clean build I rantranslated-signupanda11yon chromium twice: 39 passed both times, with no flake. - Nothing else changed since round 2.
git diff 07c9b0d 8321c30 --statlists 4 files: the spec (onlyENGLISH_WORDS,SHARED_WITH_ENGLISH,englishLeftIn,englishInCatalogandexpectNoEnglish),docs/translating.md, thetranslateskill and CLAUDE.md. The three docs name the table and say never to add a word to quiet a message left in English. No test is added or removed; the spec has one moreexpect((89, was 88), theinnerTextline. - Round 2's other conclusions stand, since none of those files changed: no check lost against
main, no hiddensvin the per-language specs, andE2E_UNSHIPPED_LOCALESset only inplaywright.config.ts'swebServer.env. - The PR body matches the code: "The fix", the Build-tab group-order row and "Review round 2".
Earlier threads: all resolved (the one round 2 thread). Copilot answered that it couldn't review (quota).
Checks: CI is green on 8321c30 (lint-type-test, e2e, CodeQL). Locally on 8321c30, on a database of my own:
pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test: pass (242 files, 3454 passed and 1 expected fail).- e2e on a production build, chromium: the proof above, then
translated-signupanda11ytwice, 39 passed each time.
The tophat passed on 07c9b0d (ux=no), and no runtime code changed since (the shared check prints 0).
Gate: auto. Only tests, test helpers, scripts, docs and comments change, and nothing a person using OpenSignup sees.
https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Generated by Claude Code
The organizer smoke built its own list of English words from the catalogs, so, like the participant check before #935's fix, a message left in English in a language's catalog took its words off the list on the very page it should catch. It now runs the same check as the participant pages, moved to tests/e2e/helpers/no-english.ts: ENGLISH_WORDS, gaining the organizer app's buttons, tabs and statuses, less the words SHARED_WITH_ENGLISH declares a language says too, over textContent and innerText, with the catalog scan only naming the messages that write a word it finds. Until a language ships, the smoke writes it into the signup it makes (storeSignupLanguage, as the story spec does), so the signup's own words are in the organizer's language, as they will be once it ships. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
main renamed swedish-signup.spec.ts to translated-signup.spec.ts and runs it in every catalog language (#935). The screenshot command, the config's TRANSLATION_SPECS and the docs now name it beside the two organizer specs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SSv8YrdMQVvWsYteJB
Part of #637: the "adding a language" half, tests for every language.
The stack
The test PR of the localization stack (#619). Everything below it in the stack has merged, so it's based on
mainnow: review againstmain. Its follow-up, #952 (organizer tests in every language), builds on it.The problem
The owner wants OpenSignup to work in any language, not Swedish in particular (decided 14 November 2026). But the stack wrote the e2e specs, translation screenshots, email samples and label-fit checks for Swedish by name: a
swedish-signup.spec.ts, amakeSwedishSignupseed, Swedish sample emails listed by name. Adding a second language meant copying all of it (six steps indocs/translating.md).The fix
Every language with a catalog but English is a test language (
TEST_LOCALESin the newsrc/i18n/testing/locales.ts, fromCATALOG_LOCALES), and the checks run once for each. A new language gets them by adding its catalog.tests/e2e/helpers/seed.ts):makeSignupsIn(locale)makes an open signup with sign-ups, a draft for its Build tab, and a closed and an archived signup in each test language, underseed.languages[locale]. Field names come from the language's catalog (participant.defaults). What an organizer would write is per language inORGANIZER_TEXT; Swedish keeps its text, so its pages and screenshots are as before, and a language without an entry getsANY_LANGUAGE's.swedish-signup.spec.tsis nowtranslated-signup.spec.ts, one block per language, named by the language's English name, so Swedish's test names are unchanged.a11y,precompiled-messages,build-tab-languageandslot-row-layoutloop over the languages too. Every expected text comes from the language's catalog (messagesIn).helpers/swedish.tsbecamehelpers/languages.ts.main's 16 English words, less any a language declares inSHARED_WITH_ENGLISH(in the spec): words it really writes as its own, as Dutch writes "link". Swedish's entry is empty, so its pattern ismain's. A language without an entry shares none. When a page fails, the failure names the catalog's messages that write the English it found ("translate each message, or add a word … toSHARED_WITH_ENGLISH"). The check runs ontextContentand oninnerText, so a word at an element's edge is caught too.E2E_UNSHIPPED_LOCALES: one list,UNSHIPPED_LOCALESintests/e2e/helpers/unshipped-locales.ts, whichmainalready works out (Word every organizer refusal from the catalog, and check both halves launch together #996) for the serverplaywright.config.tsstarts. It stays e2e-only. This branch's second list (UNSHIPPED_TEST_LOCALES) is gone; a spec that finds a seeded signup in English names the value from the same list.scripts/lib/email-samples.tsbuilds each participant email and the sign-in email in every test language (<name>-<locale>, thenmagic-link-<locale>), with what each must print taken from the catalog.emails.test.tsxchecks each language has all five;worker-render.test.tsderives its list.OTHER_LOCALE, with titles built from its English name, so names are unchanged. Tests of what Swedish says (its dates, plurals, wordings, language names) stay Swedish's.KEEP_IT_PRIVATE(commit-dialog.test.tsx) fails at test time naming itself for a language without an entry, rather than at typecheck.docs/translating.md"Adding a language" is the catalog, the glossary, translating both audiences and the review, then what the tests do for the language by themselves, and the tables that keep what a language says (KEEP_IT_PRIVATE,inSentenceandSHARED_WITH_ENGLISH). Thetranslateskill and CLAUDE.md say the same.Reworked on 16 November 2026
This branch predated the owner's 14 November redesign. I merged
maininto it (no rebase), with the rule that the stack wins on behaviour: an organizer's language is stored once, at account creation; a signup has its own; the language comes fromresolveLocaleand the helpers insrc/i18n/locale.ts. Thenmainagain for #1013, #1010 and #1011.Tests of the per-visit browser guess are gone, each taken from
main, which tests the opposite:chooseOrganizerLocale's cases inorganizer-locale.test.ts, the account settings page's "browser's top language" case, and the "browser step" cases of the REST create route, Magic Compose and the new-signup action. (src/i18n/organizer.test.tshad already leftmainin #997.)Every Swedish-only test on
main, and where its check is now:mainswedish-signup.spec.ts, all 27 tests in 5 blockstranslated-signup.spec.ts, same blocks and titles, once per test language. This includes #1012's checks: the open page's<html lang>,og:localeand footer (expectSignupLayoutIn(page, locale)), and the 6 "pages, around what they show" tests (page, edit, unsubscribe, broken link, draft, archived). It also includes the organizer's strip and Preview banner in the organizer's language, with the banner found by its status, #888's "open" wording, #999's tip, and the tip's accessible description andlang. Each test makes the same number ofexpects as before (88 in all).a11y.spec.ts: the Swedish page, commit dialog, edit page and unsubscribe pagebuild-tab-language.spec.ts: a Swedish signup's Build tab in anen-USand ansv-SEbrowser (2 × 2), and "names a new field … in Swedish"withRegion(locale).main's added checks are kept: the Fields button is the organizer's (en), and each slot's time and date heading are marked with the signup's language. The new field's names come fromparticipant.defaultsrather than "Namnlös" and "Alternativ 1". The organizer blocks keep their titles; the first now loops overTEST_LOCALES.build-tab-language.spec.ts: the Build tab's group order, the literalApa, Zebra, Äpple, ÖdlalocaleCompare(…, locale)in its own Node, the same call the tab makes, so it holds for any language. The check that the browser's order matches the server's is kept, andBuildWysiwyg.test.tsxstill pins the Swedish order.slot-row-layout.spec.ts: "in Swedish" (5) and "in Swedish, closed, with your own sign-up" (4)precompiled-messages.spec.ts: Swedish counts, and the Swedish sheet's messagesemail-samples.ts: the four*-svparticipant samples andmagic-link-svemails.test.tsx: "includes every email in Swedish"magic-link-<code>last and a guard that the English participant list is the four it was.worker-render.test.ts: the list with*-svandmagic-link-svTEST_LOCALES, same order for Swedish.organizer-language.spec.ts: the CSV request'saccept-language: 'sv'OTHER_LOCALE. The organizer specs already loop over every catalog language.Kept Swedish-specific, on purpose:
slot-label,format-duration), language names (Svenska,sv_SE,inSentence), subjects (subjects.test.ts,scripts/render-messages.tsunder the worker's toolchain), the Swedish confirmation email innotify.db.test.ts, and the eval harness.docs/translating.md's table, written withsv.ORGANIZER_TEXT,SAMPLE_TEXT,KEEP_IT_PRIVATEandSHARED_WITH_ENGLISH.main's newer unit tests that use Swedish as "another language" outside the files this PR touches (for exampleopen-signups-locale.db.test.tsand the account settings tests). They name Swedish, so a new catalog doesn't change them, and the fake second language below broke none of the unit tests among them. Where a file this PR touches mixed the two, I usedOTHER_LOCALEthroughout. The organizer side is No test opens the organizer app in another language #952's.Review and tophat notes from round 1:
worker-render.test.tsandrender-email-templates.tsnow say so, and that the catalog check requires every message once the language ships.englishLeftInwith no word left now throws with a message.escaped(exported fromhelpers/languages.ts) before they become a pattern.deas an unshipped stand-in:organizer.test.tsis gone. The fakederun below passed every organizer-locale test.keptForTestsinsrc/i18n/locale.ts(isShownToTestsleft with Decide every page's language with one rule #997). I reworded it; that's comment-only.Review round 2 (review 5925480054), fixed in 8321c30:
SHARED_WITH_ENGLISH, as "The fix" says, and the catalog scan only words the failure. Proof, on one production build withparticipant.gonePage.editLink.bodyset to its English insv.json: "says a broken edit link isn’t working, in Swedish, with a 404" fails with the fix and passes with 07c9b0d's spec. Withsv.jsonreverted and rebuilt, it passes.textContentruns elements' text together: the check now also runs withuseInnerText. With the edit page's title set to "Your spot" insv.json, "is in Swedish, with the slot’s date and the spots line" fails with the fix and passes with thetextContentcheck alone. On a clean build it fails on nothing.\d→\p{Nd}inmatching: no change.How I checked nothing was lost
main(3f906a8) against this branch (07c9b0d):mainvitest list)vitest list, db config)playwright --list, all projects)TRANSLATION_SCREENSHOTS=18321c30 adds and removes no test.
A second language, tried locally and not committed (on 02c95b5, before the last merge of
main): I copiedsv.jsontode.jsonand addeddetoCATALOG_LOCALESandCATALOGS.pnpm typecheckasked forinSentence'sderow and column, which I added locally. That's why the guide now names that table.pnpm test: 3635 tests. OnlyKEEP_IT_PRIVATEfailed, with its message.translated-signup27,slot-row-layout9,build-tab-language9,a11y4,precompiled-messages2,organizer-language16 and the story 1.pnpm translation:screenshots: 108 passed.de/got 104 files, mirroringsv/.Tests
On 8321c30:
pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test: pass (242 files, 3454 passed and 1 expected fail).translated-signupanda11y, 39 passed.translated-signupis the only spec with the no-English check.de(a copy ofsv.json, with noSHARED_WITH_ENGLISHentry, not committed): 70 passed, 31 of them German.On 07c9b0d:
pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test: pass (242 files, 3454 passed and 1 expected fail).pnpm test:db: pass (47 files, 857 tests).pnpm build && pnpm budgets: pass, no budget change.pnpm test:e2e --project=chromium --trace off, production build, port 3200): 225 tests, 221 passed and 4 skipped. The skips are Magic Compose tests with no AI provider, as on CI. One earlier run of the same build tripped the per-IP sign-up limit (10 a minute) inpublic-commit.spec.tswith 2 workers. After I clearedrate_limitsin my own database, the rerun passed.pnpm translation:screenshots: 12 email tests and 54 e2e tests passed, 114 files.UX: no. Only tests, test helpers, scripts, docs and one comment in
src/i18n/locale.tschange.Where the brief was out of date
E2E_UNSHIPPED_LOCALESwas already worked out bymain(Word every organizer refusal from the catalog, and check both halves launch together #996), across both audiences. I keptmain's list and dropped this branch's.organizer-language-story.spec.ts) and the organizer specs were already per language, so there was nothing to port there.mainadded a second per-language table,inSentence, which is a type error rather than a test failure for a new language. I kept it that way, since it wasmain's choice ("which the type asks for"), and documented it.🤖 Generated with Claude Code
https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt