docs

SSR API

Import server helpers from @linguanahq/react/ssr.

resolveRequestLocale(input)

type ResolveRequestLocaleInput = {
  request: Request;
  override?: string | null;
  userPreference?: string | null;
  supportedLocales: readonly string[];
  defaultLocale: string;
  cookieName?: string;
};

Reads the configured cookie (default linguana_locale) and Accept-Language, then delegates to the shared precedence algorithm. It returns one of the supported matches or the default.

createRequestHydrationState(locale, catalogs)

Returns schema-versioned LocaleHydrationState after validating every catalog. Pass it unchanged to LocaleProvider.hydrationState on the initial render.

Precedence

  1. Explicit application override.
  2. Signed-in preference supplied by the host.
  3. First-party cookie.
  4. Weighted Accept-Language match.
  5. Project default.

Exact locale matches win before language-only matches.

See also

Server rendering setup · TanStack Start

Did this page get you to a working result?

On this page

No Headings