LocaleResolver

Learn about the function that resolves the preferred locale.

This type describes the function the SDK uses to resolve the preferred locale for a request.

Provide one through the localeResolver option to localize content based on the URL, subdomain, headers, or cookies.

Definition

This type has the following shape:

type LocaleResolver = (event: H3Event) => Promise<string | null> | string | null;

The function receives the H3 event and returns the locale, or null to use the default. It may be synchronous or asynchronous.