Skip to content

Add built-in localizations and locale matching - #42

Draft
akxue wants to merge 1 commit into
mainfrom
hypeship/built-in-localizations
Draft

akxue wants to merge 1 commit into
mainfrom
hypeship/built-in-localizations

Conversation

@akxue

@akxue akxue commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

context

the hosted sign-in page and the react component render in english for everyone. integrators can pass their own localization strings, but there are no built-in translations, and some text can't be translated at all: the 18 error-code titles and descriptions on the error step and the "powered by" footer are hardcoded english.

changes

  • moves the error-code copy (errorCodeMessages) and the footer (poweredBy) into Localization, so every string the component owns goes through it. captcha_blocked still prefers the server's message when there is one.
  • ships complete localizations for da, de, es, fi, fr, it, nb, nl, pl and sv, exported as LOCALIZATIONS alongside english.
  • adds matchLocale(preferred), which returns the first language tag with a built-in localization, matching on the language subtag (sv-SE → sv, no → nb).
  • Localizer now requires complete mfaTypeLabels and errorCodeMessages maps, so a localization missing a string fails typecheck.

translations follow the register google uses on its sign-in pages: formal in german and french, informal elsewhere.

text from the session itself (field labels, placeholders, option text, server error messages) is unchanged and shows as the api sends it.

testing

  • bun test: 110 pass, including new tests for matchLocale, placeholder interpolation in every localization, localized error-code copy, partial overrides keeping default error copy, and the localized footer.
  • bun run typecheck, bun run build, bun run format:check pass.
  • rendered the demo's prime, form and human-verification states in de and pl, and the hosted page's error state in de and fi, in headless chromium. no overflow at a 480px width.
  • not done: native-speaker review of the translations. they should be reviewed per language before release.

@vercel

vercel Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
managed-auth-react-demo Ready Ready Preview Oct 31, 2026 5:55am UTC

This branch was successfully deployed

1 active deployment
Preview — 1e5ef34a Deployed Oct 31, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant