import { type Locale } from './types.js'; /** * Header-like source for {@link resolveLocale}. Pass a `Request` (its `cookie` and * `accept-language` headers are read) or a plain object with the raw header * strings — keeps the helper framework-agnostic. */ export interface LocaleSource { /** Raw `Cookie` request header, e.g. `theme=dark; urbicon-locale=de`. */ cookie?: string | null; /** Raw `Accept-Language` request header, e.g. `de-DE,de;q=0.9,en;q=0.8`. */ acceptLanguage?: string | null; } export interface ResolveLocaleOptions { /** * Locales the app actually ships data for. Resolution never returns a locale * outside this set. Defaults to the locales currently registered in the * registry (so it tracks "data optional"), falling back to all * {@link SUPPORTED_LOCALES} if nothing is registered yet. */ supportedLocales?: readonly Locale[]; /** Returned when neither cookie nor Accept-Language yields a supported locale. @default 'en' */ defaultLocale?: Locale; /** Name of the cookie holding the persisted locale choice. @default 'urbicon-locale' */ cookieName?: string; } /** * Resolve the initial locale for a request, server-side: persisted cookie first, * then the browser's `Accept-Language`, then the default. Feed the result to * `` so SSR and hydration agree (no client-only * `navigator.language` guess, no hydration mismatch). * * ```ts * // +layout.server.ts * export const load = ({ request }) => ({ locale: resolveLocale(request) }); * ``` * * Detection is the consumer's choice — this helper is optional. Persisting the * cookie on switch is the consumer's job too (e.g. in the provider's * `onLocaleChange`); this only reads it back. */ export declare function resolveLocale(source: Request | LocaleSource, options?: ResolveLocaleOptions): Locale;