Core API
Locale Detection
detectLocale() resolves the best available locale from multiple sources in priority order.
ts
import { detectLocale } from '@pico-intl-dev/core/detect';
const locale = await detectLocale({
supported: ['en', 'es'],
fallback: 'en',
}); Key points
- detectLocale() can read browser, storage, and environment hints.
- parseAcceptLanguageHeader() is available for server environments.
- Always provide a safe fallback locale.
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.