Skip to content

A signup has no language, and an instance has no default language #625

Closed

Description

@richshaw

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.locale in SignupSettingsSchema (src/schemas/signups.ts), stored as z.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 break requiresEmail, sendsReminders, the Build tab's parse and every later update.
  • Validate only a value the caller sent. createSignup and updateSignup reject a language outside SHIPPED.participant with invalid_input. updateSignup merges 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 trap sentGroupBy already avoids.
  • Read it with resolveLocale(value, fallback), pure, in src/i18n/config.ts: the value if it's in CATALOG_LOCALES, else the fallback.
  • DEFAULT_LOCALE, an optional runtime variable in src/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, in config.ts: the instance's language when it's set and in that audience's SHIPPED list, else 'en', so an operator who sets sv early doesn't get half-translated pages. Only instanceDefaultLocale() in src/i18n/server.ts calls getEnv().
  • 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.participant has more than one entry. So nothing shows yet.
  • API and MCP.
    • Add locale to toPublicSignup's allow-list (src/app/s/[slug]/public-signup.ts), so API clients can mark the content's language.
    • update_signup gets the setting automatically, since its settings schema derives from SignupSettingsSchema. Add a .describe() listing the allowed values, and update the registry snapshots.
  • Docs.
    • An .env.example entry.
    • 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: .env for Docker Compose, [env] or fly secrets on 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.

Watch for

  • Keep config.ts pure. env.ts imports CATALOG_LOCALES from it, so the reverse import would be a cycle, and unit tests don't set DATABASE_URL.
  • It's not a build argument. Nothing statically prerendered needs it, so it needs no NEXT_PUBLIC_ prefix and no Dockerfile wiring.
  • Check docs/connect-ai-assistant.md if it lists settings, and add a CHANGELOG entry.

Choices this makes

  • Store it in settings (jsonb). Default: yes. No migration, no new query.
  • DEFAULT_LOCALE is 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, sendsReminders or an unrelated settings save; resolveLocale and defaultFor cases.
  • The Settings control renders when SHIPPED.participant has two entries (a test) and not otherwise.
  • pnpm lint && pnpm typecheck && pnpm knip && pnpm test and pnpm test:db pass.

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

  1. added
    enhancement
    pipeline:ux
    on Oct 25, 2026
  2. added
    pipeline:working
    and removed on Nov 14, 2026
  3. self-assigned this
    on Nov 14, 2026
  4. added
    pipeline:working
    and removed
    pipeline:working
    on Nov 14, 2026
  5. removed
    pipeline:ux
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions