Repository navigation
Description
Needs your OK: this stores a language on each signup and adds an optional DEFAULT_LOCALE setting for operators. Nothing shows in the app until Swedish ships (the launch step in #619). The MCP update_signup description and the public signup API gain a locale. Swap pipeline:proposed for pipeline:ready to have it built.
What happens
Nothing records which language a signup is written in, so its pages and emails can't follow it. An operator who runs OpenSignup for one language community, a Swedish school for example, has no way to say so.
Fix, in outline
settings.localeinSignupSettingsSchema(src/schemas/signups.ts), stored asz.string().max(35).optional(). It's lenient on purpose: an unknown stored value must not make the whole settings object fail to parse, which would breakrequiresEmail,sendsReminders, the Build tab'sparseand every later update.- Validate only a value the caller sent.
createSignupandupdateSignupreject a language outsideSHIPPED.participantwithinvalid_input.updateSignupmerges the stored settings under the patch before parsing, so checking the merged object would make every unrelated save fail on a signup whose stored language has since left the list. It's the same trapsentGroupByalready avoids. - Read it with
resolveLocale(value, fallback), pure, insrc/i18n/config.ts: the value if it's inCATALOG_LOCALES, else the fallback. DEFAULT_LOCALE, an optional runtime variable insrc/lib/env.ts(z.enum(CATALOG_LOCALES).optional(); a bad value fails at startup like any env error). When set, it's the instance's language.defaultFor(audience, instanceDefault), pure, inconfig.ts: the instance's language when it's set and in that audience'sSHIPPEDlist, else'en', so an operator who setssvearly doesn't get half-translated pages. OnlyinstanceDefaultLocale()insrc/i18n/server.tscallsgetEnv().- A "Signup language" control in the signup's Settings tab: a plain form like "Ask for an email address", with no client JS, rendered only when
SHIPPED.participanthas more than one entry. So nothing shows yet. - API and MCP.
- Add
localetotoPublicSignup's allow-list (src/app/s/[slug]/public-signup.ts), so API clients can mark the content's language. update_signupgets the setting automatically, since its settings schema derives fromSignupSettingsSchema. Add a.describe()listing the allowed values, and update the registry snapshots.
- Add
- Docs.
- An
.env.exampleentry. - A line in the README's "Branding your instance": set it when the instance serves one language community, and leave it unset to follow each organizer's browser.
- Where a runtime variable goes on each platform:
.envfor Docker Compose,[env]orfly secretson Fly. - Say plainly that setting it also switches every signup that has no language of its own (all signups made before this work) to that language at once.
- An
Watch for
- Keep
config.tspure.env.tsimportsCATALOG_LOCALESfrom it, so the reverse import would be a cycle, and unit tests don't setDATABASE_URL. - It's not a build argument. Nothing statically prerendered needs it, so it needs no
NEXT_PUBLIC_prefix and noDockerfilewiring. - Check
docs/connect-ai-assistant.mdif it lists settings, and add a CHANGELOG entry.
Choices this makes
- Store it in
settings(jsonb). Default: yes. No migration, no new query. DEFAULT_LOCALEis optional, and when set it comes before the browser's guess for organizers (the next step). Default: yes, so a self-hosted Swedish school is Swedish whatever its organizers' phones say. opensignup.org leaves it unset.
Order
After #620, because CATALOG_LOCALES and SHIPPED come from it.
Done when
- Tests: a sent unknown language is refused; a stored unknown language doesn't break
requiresEmail,sendsRemindersor an unrelated settings save;resolveLocaleanddefaultForcases. - The Settings control renders when
SHIPPED.participanthas two entries (a test) and not otherwise. pnpm lint && pnpm typecheck && pnpm knip && pnpm testandpnpm test:dbpass.
Planned with the owner in https://claude.ai/code/session_01EFKmj716ZY3b3SwR8TV8Y2 and checked against the code on main at 35288fa. The full plan is 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). This is part of step 1.1 there.
Activity