Recipes
Patterns we keep reaching for. Each is a copy-pasteable starting point — adapt to taste.
| Recipe | What it covers |
|---|---|
| Switching locales | URL-driven, cookie-driven, and localStorage-driven setups. |
| Lazy-loading translations | Code-split locale bundles, suspense, preloading. |
| Next.js (App Router) | Server components, locale detection, route segments. |
| Vite + React Router | Per-route locale bundles, import.meta.glob. |
| Testing | Render helpers, key assertions, snapshot strategies. |
| Intl formatters | Plurals, currency, relative time, lists — using Intl.*. |
Advanced typing
If you'd like the compiler to catch typos in descriptors, the TypeScript guide has a 10-line useTypedLocalize helper that derives a literal-union descriptor type from your translations.
Have a recipe to add?
Open a PR — recipes are the easiest contribution path.