Setu-TS
    Preparing search index...

    Interface LocaleMiddlewareOptions

    Options for localeMiddleware: how the request locale is resolved.

    Resolution tries, in order, the query parameter, the cookie, Accept-Language, tenantLocale, and finally the default — the first entry of supportedLocales. Every candidate is matched against supportedLocales only.

    0.9.0

    interface LocaleMiddlewareOptions {
        cookie?: string | false;
        exclude?: readonly PathPattern[];
        query?: string | false;
        supportedLocales: readonly string[];
        tenantLocale?: (tenant: ITenant) => string | undefined;
    }
    Index
    cookie?: string | false

    The cookie that selects a locale; false disables it. Default 'setu_locale'. While enabled, every governed response carries Vary: Cookie — correct, and costly for CDN caching, which is why it can be turned off.

    exclude?: readonly PathPattern[]

    Paths the middleware skips entirely: no resolution, no headers. Default the six operational paths (/live, /ready, /health, /metrics, /openapi.json, /docs); [] disables exclusion.

    query?: string | false

    The query parameter that selects a locale; false disables it. Default 'locale'.

    supportedLocales: readonly string[]

    The supported BCP 47 tags; the first is the default.

    tenantLocale?: (tenant: ITenant) => string | undefined

    A tenant's default locale, consulted after Accept-Language when the request carries a resolved tenant (the tenancy middleware runs at 40, before this one at 45). Its answer is matched like any candidate. A throw propagates: this is application code, not client input.