> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: i18n

## Article: i18n

## Article Link: https://dev.wix.com/docs/sdk/core-modules/essentials/i18n.md

## Article Content:

# i18n

> **Note:** This API is not intended for use in [site development](https://dev.wix.com/docs/sdk/articles/get-started/about-site-development.md), when [coding in Blocks](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-blocks/code-in-blocks/about-coding-in-blocks.md) or when building [Wix Headless sites and apps](https://dev.wix.com/docs/go-headless.md).

The `i18n` submodule allows the code in an app's [frontend extensions](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/about-extensions.md#frontend-extensions) to access the active language and locale settings for each interface. This allows apps to render their text in the same language and locale that the Wix user has chosen for the site.

When you are localizing your app, it is important to retrieve the localization settings for each [extension's](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/about-extensions.md) interface. For example, [dashboard extensions](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/dashboard-extensions/about-dashboard-extensions.md) should render text in the Wix user's account language, but [site extensions](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/site-extensions/about-site-extensions.md) should render text in the site's language. 

See also:
- [About App Localization](https://dev.wix.com/docs/build-apps/launch-your-app/localization/about-app-localization.md)
- [Implement Localization in Your App Extensions](https://dev.wix.com/docs/build-apps/launch-your-app/localization/implement-localization-in-your-app-extensions.md)

## Import statement
```js
import { i18n } from '@wix/essentials';
```

## Methods

### `getLanguage()`
Retrieves the language setting for the app extension that calls the method.

#### Method Declaration
```js
getLanguage(): string
```

#### Returns
2-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. See [Languages Available in Wix](https://support.wix.com/en/article/languages-available-in-wix).

#### Example
Set a string to Spanish if the site's language is set to Spanish. Otherwise, the string's language defaults to English.

```js
import { i18n } from '@wix/essentials';

const helloWorldMessage = await i18n.getLanguage() === 'es' ? 'Hola Mundo!' : 'Hello World!';
```

### `getLocale()`
Retrieves the locale setting for the app extension that calls the method.

#### Method Declaration
```js
getLocale(): string
```

#### Returns
Locale in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.

Typically, this is a lowercase 2-letter language code, followed by a hyphen, followed by an uppercase 2-letter country code.
For example, `en-US` for U.S. English, and `de-DE` for Germany German.

See [Languages Available in Wix](https://support.wix.com/en/article/languages-available-in-wix).

#### Example
Save the current date and time as a variable in the date format of the site's locale.

```js
import { i18n } from '@wix/essentials';

const date = new Date();

const formattedDate = new Intl.DateTimeFormat(i18n.getLocale()).format(date)
```