Skip to main content

Recipes

Patterns we keep reaching for. Each is a copy-pasteable starting point — adapt to taste.

RecipeWhat it covers
Switching localesURL-driven, cookie-driven, and localStorage-driven setups.
Lazy-loading translationsCode-split locale bundles, suspense, preloading.
Next.js (App Router)Server components, locale detection, route segments.
Vite + React RouterPer-route locale bundles, import.meta.glob.
TestingRender helpers, key assertions, snapshot strategies.
Intl formattersPlurals, 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.