Core / locale: LocaleControlsConfig
Functions, types, and exports for Core / locale: LocaleControlsConfig.
Page outline
import type { LocaleControlsConfig } from "@palamedes/core/locale"
type LocaleControlsConfig<TLocale extends string> = {
/** Supported locales; the first is not special, `defaultLocale` decides. */
locales: readonly TLocale[];
/** Fallback when nothing else resolves. */
defaultLocale: TLocale;
/** Display labels; defaults to `Intl.DisplayNames`, then the locale code. */
labels?: Partial<Record<TLocale, string>>;
/** Cookie names; default to `locale` and `locale-choice`. */
cookies?: {
locale?: string;
choice?: string;
};
/** Optional host strategy (locale per host). */
hosts?: HostLocaleConfig<TLocale>;
/**
* Scheme for host-carrying URLs from `canonicalUrl` and `suggest` (e.g.
* `"https"`). Without it those URLs are protocol-relative (`//host/path`),
* which stays correct on http (local) and https (deployed) alike.
*/
protocol?: string;
};
Properties
| Name | Type | Required | Description |
|---|---|---|---|
locales | readonly TLocale[] | Yes | Supported locales; the first is not special, defaultLocale decides. |
defaultLocale | TLocale | Yes | Fallback when nothing else resolves. |
labels | Partial<Record<TLocale, string>> | No | Display labels; defaults to Intl.DisplayNames, then the locale code. |
cookies | { locale?: string; choice?: string } | No | Cookie names; default to locale and locale-choice. |
hosts | HostLocaleConfig<TLocale> | No | Optional host strategy (locale per host). |
protocol | string | No | Scheme for host-carrying URLs from canonicalUrl and suggest (e.g."https"). Without it those URLs are protocol-relative (//host/path),which stays correct on http (local) and https (deployed) alike. |
Last updated: November 14, 2026