Config

Persistence

Defines the strategy for persisting locale state.


Note
Currently, Intor provides cookie-based persistence as the only mechanism for preserving locale state.
Locale cookies are disabled by default. Applications must explicitly enable them with cookie.enabled: true.

Defines how locale state is persisted via cookies.

defineIntorConfig({
  cookie: {...},
});

Whether to enable reading and writing the locale cookie.

Defaults to false

When disabled, Intor does not read existing locale cookies or write locale cookies on the first visit or when switching locales.

To persist the locale in a cookie, explicitly enable it:

defineIntorConfig({
  cookie: {
    enabled: true,
  },
});

The name of the cookie used to store locale state.

Defaults to "intor.locale"

defineIntorConfig({
  cookie: {
    enabled: true,
    name: "my-cookie-name",
  },
});

The domain scope of the cookie.

Defaults to undefined

The path scope of the cookie.

Defaults to "/"

The cookie lifetime, in seconds.

Defaults to undefined

Whether to restrict the cookie to HTTP(S) access only.

Defaults to false

Whether the cookie is only sent over secure (HTTPS) connections.

Defaults to process.env.NODE_ENV !== "development"

The SameSite policy of the cookie.

Defaults to "lax"