Core API
Locale Management
pico-intl provides a clean API for reading and changing the active locale, with optional persistence via storage adapters.
ts
i18n.locale;
await i18n.setLocale('es');
const unsubscribe = i18n.onLocaleChange((locale) => {
console.log('locale changed', locale);
}); Key points
- setLocale() is async because loaders may fetch catalogs.
- Framework adapters expose locale state using their framework idiom.
- Next.js locale switching uses navigation, not setLocale().
Next step
Copy the example into a small fixture, run the validation commands, and keep framework-specific routing, hydration, or SSR behavior covered by your app tests.