# LocaleResolver

Learn about the function that resolves the visitor's preferred locale.

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

Provide one through the [resolver options](/reference/sdk/hydrogen/api/types/croct-options) to override the default, which derives the locale from the storefront's `i18n` configuration.

## Definition

The type has the following shape:

```ts
type LocaleResolver = (context: ResolverContext) => Promise<string | null> | string | null;
```

The function receives the [Hydrogen request context](/reference/sdk/hydrogen/api/types/resolver-context) and returns a [BCP‑47](https://www.rfc-editor.org/info/bcp47) locale such as `en-US`, or nothing to use the [default locale of your workspace](https://app.croct.com/redirect/organizations/-organization-/workspaces/-workspace-/settings). It may be synchronous or asynchronous.
