Repository navigation
Conversation
A pure function for the notice on Your signups (#640): given the rows the page already loads, it says whether the titles look written in a language. One title with a word from the language's short list settles it; titles spelled only with its letters (å, ä, ö for Swedish) count when they make up at least half the list, since names and the neighbouring languages write those letters too. A word with a letter the language never writes (æ, ø, ü, ß) is never evidence. The markers are a table per language, so the next one adds an entry and no code. Server-only, beside the other i18n helpers; its only caller so far is its test, and the notice that uses it comes later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
…otice Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
The word list left out every word Danish or Norwegian share with Swedish, so the commonest words in Swedish titles (på, som, det, efter, fredag, kaffe) said nothing and a lone Swedish title was found less than half the time. A listed word now only has to be one English doesn't have, and the list gains small words, days and seasons and signup words. A second table field, sharedWithEnglish, holds till and med, which English has too: one counts only in a title that also has a word spelled with å, ä or ö, so "Kör till bortamatchen" says yes and "Open till noon" no. The tests pin the cost: Danish and Norwegian titles with på or hos now say yes, and so do "Open till late in Malmö" and "Med kit for Åre trip", the one way an ordinary English title can. Every word left out because English has it is pinned by an English title that stays no. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Once Swedish ships to participants, Your signups shows "Your signups can be in Swedish now.", with the same line in Swedish, to an organizer who hasn't saved a language, on an instance with no DEFAULT_LOCALE, when their browser asks for Swedish first or their signups look Swedish: from the titles the page already lists, or else from the start of the workspace's newest descriptions, read in one bounded statement. Descriptions only add evidence. Use Swedish saves sv as the organizer's language for new signups and goes on to account Settings, whose saved=language flash asks about their open signups (#639). Keep English saves en. Either answer saves a language, so the notice needs no dismissal of its own. Telemetry: language_notice.shown, once per organizer after the response (recordOrganizerView's new `once`), and language_notice.answered, in the save's transaction. Documented in docs/telemetry.md; privacy page updated. The Banner takes children for the Swedish line and the buttons. 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
Signups that recur name their day in the plural (måndagar, "on Mondays") or the definite form (måndagen, "the Monday"), and their weeks and evenings in the plural (veckor, kvällar), so these join Swedish's words. Matcher (an English word) and helger (a surname) stay out. Each new word is pinned by a title that says no without it; every English title in the tests stays no. From #932's second review. 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
Tophat: failedRan 259ca3f locally on production builds (
Failure: the notice's text fails WCAG AA contrastTo reproduce: add It should pass. The Optional
UX, for the ownerOnce Swedish ships, an organizer who hasn't chosen a language, on an instance without Generated by Claude Code |
Independent translation reviewThis is the Line:
Verdict: correct, natural and true to the glossary. Ship it as it is.
Two nits, neither about the wording:
The fix round also takes the tophat's failure (the notice's contrast, 4.07:1) and its optional point (a double click writes two https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt Generated by Claude Code |
…r row - The offer banner's text is brand-hover (#1658c4), 5.7:1 on its tint, where the Preview banner's brand blue is 4.07:1 and fails WCAG AA. Only the offer kind changes. A banner title may now be a node. - The Swedish line moves into the title, under the English, as its twin, ahead of the explanation, still with lang="sv". - language_notice.answered is recorded only when the organizer had no saved language before the answer, with their row locked first, so a double click, a second tab or a stale form saves again but records nothing. From #934's tophat and its independent translation review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Address round: tophat failure, its optional point, and the translation review's nitFixed in
Checks on https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt Generated by Claude Code |
|
Closing without merging, at the owner's decision: there'll be no on-screen notice when a language launches. Swedish will be announced in the CHANGELOG and release notes, and organizers can change their language in account Settings. #640 is closed as not planned. Two findings from this PR's tophat still stand, outside it:
https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt Generated by Claude Code |
Fixes #640.
Merge after #933 and #932.
The stack
PR 41 of the localization stack (#619). Based on #933 (
claude/issue-639-post-save-prompts, head2bb311d) with #932 (claude/issue-640-looks-swedish, headbae3503) merged in; review against #933's branch. #932's guess is in this PR's diff against that branch until #932 merges.The problem
When Swedish ships (#639), signups made before it stay English, new hand-built ones follow the browser (many Swedes run theirs in English), and nothing tells an organizer. "Language for new signups" and each signup's "Signup language" are there, and #639's two questions appear only after one of those is saved. So the launch would reach only the organizers whose browser says Swedish and those who go looking.
The fix
src/app/app/(chrome)/page.tsx,swedish-notice.tsx): "Your signups can be in Swedish now." with its Swedish twin right under it in the title (lang="sv"), a line on what the language is for, and Use Swedish / Keep English. It reusessrc/components/banner.tsx, which gains achildrenslot (the buttons), a title that may be a node (for the twin), and anofferkind: the Preview banner's tint with darker text,text-brand-hover(#1658c4), 5.7:1 on the tint, so it meets WCAG AA. The other kinds are unchanged. It isn't a live region: it's part of the page from the start.swedishNoticeReason): only while Swedish is inSHIPPED.participant, the organizer'sorganizers.localeis empty, and noDEFAULT_LOCALEis set; and then only when their browser's first language is Swedish, or their signups look Swedish (Guess whether an organizer's signups look Swedish from their titles #932'ssignupsLookWrittenInover the titles the page already lists, or else the start of their descriptions, below). Nothing shows today: Swedish hasn't shipped.på svenska; Finnish would need it in a case), which a{language}placeholder can't give, so the next language needs words of its own anyway. Written for Swedish, the check names'sv'three times; a loop over the shipped languages would be no shorter, and harder to read.answerSwedishNoticeAction, as Add a Signup language control to the Settings tab, hidden while one language ships #899 and Let an organizer save a language for new signups, hidden until a second language ships #904's forms are), sending onlylocale. The newanswerLanguageNoticeservice saves it throughupdateOrganizerLocale(Let an organizer save a language for new signups, hidden until a second language ships #904), with its refusals, and records which answer it was in the same transaction, only when the organizer had no saved language before it (their row is locked first), so a double click, a second tab or a stale form saves again but records nothing. The form names no organizer, so it can only change the signed-in organizer's own language.svand goes on to account Settings withsaved=language, exactly where "Language for new signups"' own Save lands, so Add a button that switches an organizer's open signups to their language #933's flash does the rest: "Saved" beside the choice, then "Use Svenska for your open signups too?" when an open signup is in another language, whose Yes is Add a button that switches an organizer's open signups to their language #933'ssetOpenSignupsLocale. Nothing of Add a button that switches an organizer's open signups to their language #933's is copied. After Add a button that switches an organizer's open signups to their language #933's second round, Yes takes the focus as the question appears, so it lands in view at 390 px too (checked in this flow: Yes at 572–606 px of an 844 px screen, focused). Nothing here depends on which button gets the focus. The reviewer of Add a button that switches an organizer's open signups to their language #933 judged that overwriting a language set on purpose is right here too: most of this audience's signups have no stored language.enand comes back to Your signups, where the notice has gone.listDescriptionStarts: 20 at most,left(description, 300), live signups only, newest first, behindrequireWorkspaceAccess). Descriptions only add evidence (descriptionsLookWrittenIn, new inwritten-in.ts): one with a word from Swedish's list says yes, one without says nothing, and they never enter the "at least half" count, as Guess whether an organizer's signups look Swedish from their titles #932's review and tophat asked. Letters and the words shared with English (till,med) don't count in a description, which is long enough to name a Swedish place in English beside "till".DEFAULT_LOCALE, whose browser isn't Swedish and whose titles say no: after the launch, that's nearly every English-speaking organizer, on every view, since they never see the notice to answer it. It's one small statement (the same filter and index as the list above it) on a page that sends three. What it buys: titles miss Swedish compounds with no listed word and no å, ä or ö ("Lussebak med scouterna", "Julpyssel", "Grillkväll i parken"), and those organizers, with an English browser, are exactly who Signups made before Swedish shipped stay in English, and nothing tells their organizers #640 is for, while a Swedish description almost always has a listed word (och, att, på, för…). The telemetry'sreasonwill say how many organizers the read finds; if it's few, taking it out is a three-line change.svshipped locally): an organizer who has chosen, and everyone while Swedish isn't shipped, 3 (session, organizer, list), as before; an undecided organizer whose browser and titles say no, 4 (the description read). Showing the notice adds no statement before the response.måndagar…söndagar,måndagen…söndagen), andveckor,kvällar, for signups that recur.matcher(English) andhelger(a surname) stay out. Each is pinned by a title that says no without it ("Simskola måndagar", "Fika fredagar"…); every English title in the tests still says no. The reviewer found 12 of 12 made-up recurring-day titles move to yes and none of 16 English titles change.docs/telemetry.md, "Language notice"):language_notice.shown{ reason, device },reasonbeingbrowser,titlesordescriptions. Followingview-tracker.ts, it's written after the response, outside any transaction, and never fails the page; it isn't written on every load:recordOrganizerViewgainsonce, which writes only when the organizer has no row of that event yet (one indexed read after the response on each view that shows the notice).language_notice.answered{ locale }:svfor Use Swedish,enfor Keep English, in the save's transaction, since it describes the save; at most one per organizer (above).offerkind's own colour moved the pages that show a banner by −4 to +5 B. The notice is server-rendered with plain forms, so the page gains no script; neither the notice's text nor the word list is in.next/static.The Swedish line
The organizer app is English (#619's organizer phase hasn't started), so only the notice's first line has a Swedish twin, for the people it's for:
organizer.swedishNotice.titleTranslated with the
translateskill (glossary: anmälningslista, du), marked withmark-translated.mjs. Both lines come from that one key (the English through the English translator, the Swedish through the Swedish one), so changing the English marks the Swedish stale. Because the catalog check fails a stale message only for an audience the language has shipped to, and organizer text won't ship in Swedish with this, a test on the page checks that this key's Swedish is recorded against today's English.Independent translation review
Passed with no findings on the wording (a different model, read-only, against the glossary and the tophat's screenshots): #934 (comment). Its two layout nits are taken: the Swedish line now sits in the title as its twin rather than below the explanation, and at 320 px it wraps onto two lines cleanly (as does the English title).
Where #640 is out of date
updateOrganizerLocaleand the privacy line it names under Organizers have no saved language #626 were built by Let an organizer save a language for new signups, hidden until a second language ships #904; the open-signups offer by Add a button that switches an organizer's open signups to their language #933 (Signups can't be in Swedish yet #639).listSignupSummariesForWorkspace, whose rows hold only titles, as it says.Follow-ups, not in this PR
maintoo: the sametext-brandon the same tint, 4.07:1. This PR fixes only its ownofferkind and leaves those exactly as they are (the tophat's 17 banner screenshots stay pixel-identical); they want their own fix.svshipped, 2 tests inorganizer.spec.tsfail, both ongetByRole('button', { name: 'Save' })finding two buttons on a signup's Settings tab (the sign-up form's and Add a Signup language control to the Settings tab, hidden while one language ships #899's "Signup language" form's). That comes from Add a Signup language control to the Settings tab, hidden while one language ships #899, not this PR. The e2e organizer also owns the Swedish seed signups, so it will see this notice once Swedish ships, and help screenshots retaken then would show it unless the seed saves a language.onceread usesactivity_by_eventand filters onactor_id, so it walks thelanguage_notice.shownrows (one per organizer ever shown) after the response; fine at today's sizes.Not done
affected-articles.mjsflags two articles only for the word "closed" inbanner.tsxand "What"/"Date" in the CHANGELOG.Tests
src/app/app/(chrome)/page.test.tsx(jsdom, Swedish shipped in the test withship()):en,sv, even an unknown one), or withDEFAULT_LOCALEset (enorsv), or while Swedish isn't shipped, and then reads nothing and records nothing;lang="sv"and sits in the title, ahead of the explanation; each button's form sends only its language; no live region;once: trueand the reason;src/app/app/(chrome)/actions.db.test.ts: Use Swedish savessv, writes onelanguage_notice.answeredrow and lands on/app/settings?saved=language; Keep English savesenand lands on/app; after Use Swedish, the read account Settings makes (openSignupsToSwitch) finds the open signup and not the draft, and its Yes (setOpenSignupsLocaleAction) puts it in Swedish; a second answer, or a stale form answered the other way, saves again but records nothing; two answers sent at once record one; an answer waits for one already being saved (a held row lock) and then records nothing; an organizer who had chosen a language already records nothing; a forged form naming another organizer changes only the signed-in one's;svwhile unshipped,xx,de, an empty value and none are refused with nothing saved or recorded; a non-organizer is refused before any write.src/services/description-starts.db.test.ts: one statement (counted with a debug hook) returns the 20 newest descriptions' first 300 characters, leaving out empty, deleted and other workspaces' signups and keeping drafts and archived ones; a workspace the actor isn't in is refused before any query.src/lib/view-tracker.db.test.ts: withonce, three views write one row per organizer; without it, every view writes.src/i18n/written-in.test.ts:descriptionsLookWrittenIn(a listed word says yes; English descriptions with Swedish names, "till" and "med" say no; letters alone say nothing; empty lists and English's missing entry; case and NFC); the 16 recurring-day titles.src/components/banner.test.tsx: children go under the body.lang,once, the answered row, the read's empty filter, limit and workspace filter, and (this round) the "no language before" condition and the row lock.svadded toSHIPPED.participantlocally and not committed; synthetic organizers and titles), at 1280 and 390 px: the notice showed for a Swedish browser (browser), a Swedish title (titles) and an English title with a Swedish description (descriptions), and not for an English organizer. Use Swedish savedsvand landed on account Settings with "Saved" and "Use Svenska for your open signups too?"; Yes put the open signup insvand left the draft. Keep English savedenand the notice was gone. Each organizer got oneshownrow however many times they loaded the page, and oneansweredrow. The only console message was a hydration warning that Playwright's own screenshot caret-hiding causes in dev (gone withcaret: 'initial'). This round: axe (WCAG 2.1 A/AA) finds nothing on Your signups with the notice showing at 1280, 390 and 320 px; a double click on Keep English sent two POSTs and wrote oneansweredrow.Run and passed on 664fa20:
pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test(215 files, 3,173 tests)pnpm test:db(46 files, 866 tests)pnpm build && pnpm budgets: every page under budget; byte changes above. No budget changes.organizer.spec.tsand the four help walkthroughs intests/e2e/help(each visits Your signups), container Chromium: 39 passed. Nothing in them reaches the notice, since Swedish isn't shipped there.svshipped locally, not committed): no violations at 1280, 390 and 320 px.🤖 Generated with Claude Code
https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt