> 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: Add Multilingual Support

## Article: Add Multilingual Support

## Article Link: https://dev.wix.com/docs/go-headless/wix-managed-headless/full-integration-astro/feature-guides/add-multilingual-support.md

## Article Content:

# Add Multilingual Support

You can support multiple languages in your [Wix-managed headless project](https://dev.wix.com/docs/go-headless/wix-managed-headless/about-wix-managed-headless.md) with the `@wix/essentials` package, which uses static content translations. Use the Wix CLI to sync translation keys between your local codebase and the [Multilingual dashboard](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Fwix-multilingual/manage-languages), and use `getTranslationFunction()` from `@wix/essentials` to retrieve translated values in your code. This way, content editors can manage translations without modifying your code.

To add multilingual support to your headless site:

1. Set up the Wix Headless environment.
1. Define your source translations.
1. Push translation keys to the dashboard.
1. Add translations on the dashboard.
1. Pull translations to the site.
1. Use translations in your code.

The end result is a multilingual site that displays translated content based on the visitor's language preferences.

> **Note:** These steps translate content you render yourself. Wix-managed pages such as the login page and checkout use a separate mechanism. To learn more, see [display Wix-managed pages in a specific language](#display-wix-managed-pages-in-a-specific-language).

## Step 1 | Set up the Wix Headless environment

This step sets up a Wix Headless site with the necessary apps and packages for multilingual support.

At the end of this step, you have a Wix Headless site with the **Wix Multilingual** app installed and the `@wix/essentials` package ready to use.

To set up the Wix Headless environment:

1. [Create a Wix Headless site](https://dev.wix.com/docs/go-headless/wix-managed-headless/full-integration-astro/get-started/create-a-project-with-the-wix-cli.md).
1. Install the [Wix Multilingual](https://www.wix.com/app-market/web-solution/wix-multilingual) app on your site.
1. Set up your [multilingual dashboard](https://support.wix.com/en/article/wix-multilingual-managing-your-languages).
1. Install the `@wix/essentials` package:

    ```bash
    npm install @wix/essentials
    ```

## Step 2 | Define your source translations

This step creates a JSON file where you define key-value pairs for your translations. The key is the translation key you use in your code to display translated text. The value is the text in the site's main language.

At the end of this step, you have a `translations.json` file with your translation keys and source text.

To define your source translations:

1. Create a file named `translations.json` in your `src` folder.
2. Add your translation keys and source text as key-value pairs:

    ```json
    {
      "title": "Welcome to My Shop",
      "subtitle": "Quality products for everyone",
      "checkout": "Continue to checkout"
    }
    ```

  You can also add a grouping level to organize related translation keys:

  ```json
  {
    "hero": {
      "title": "Welcome to My Shop",
      "subtitle": "Quality products for everyone"
    },
    "cart": {
      "checkout": "Continue to checkout"
    }
  }
  ```

## Step 3 | Push translation keys to the dashboard

This step uploads your translation keys to the **Multilingual dashboard** so content editors can add translations.

At the end of this step, your translation keys appear on the dashboard ready for translation.

To push translation keys to the dashboard, run the following command:

  ```bash
    npm run wix translation push
  ```

This command uploads the translation keys defined in `src/translations.json`, such as `checkout` or `hero.title`. The keys now appear in the **Multilingual** dashboard, where editors can add languages and input translations.

## Step 4 | Add translations to the dashboard

This step adds translations for each language you want to support in the dashboard.

At the end of this step, your translations are stored on the dashboard and ready to pull into your project.

To add translations on the dashboard:

1. In the dashboard menu, click **Website Content**, then **Multilingual**.
1. Add the languages you want to support.
1. Hover over the language section and click **Edit Translations**.
1. In the **Translation Manager**, click **Headless**.
1. [Add translations](https://support.wix.com/en/article/wix-multilingual-using-the-translation-manager).
1. Click **Save and Publish**.

## Step 5 | Pull translations from the dashboard

This step fetches the translations from the dashboard so you can use them in your app.

At the end of this step, you have JSON files for each language stored locally in your project.

To pull translations, run the following command:

  ```bash
    npm run wix translation pull
  ```

This command connects to the Wix Multilingual backend, downloads translation files for all enabled languages, and stores them in the `.wix/multilingual` folder.

Because every Wix Headless scaffold gitignores `.wix/` by default, `.wix/multilingual` isn't committed to your repository. When you enable translations, run `npm run wix translation pull` in every clean clone and CI environment before building. Otherwise, `astro build` and `astro dev` fail at startup.

## Step 6 | Modify astro.config.mjs

Use Wix Multilingual, not Astro's i18n routing, for locale routing. Wix's localization middleware strips the locale segment before Astro matches folder-based i18n routes, and `@wix/astro-pages` registers page entries from each route folder. Keep `src/pages` flat and use `i18n.getLanguage()` from `@wix/essentials` to read the current locale instead of Astro's `currentLocale`.

In your `astro.config.mjs` file, update the `wix` object by adding `essentials: true` and `translations: true`:

```js
wix({
    htmlEmbeds: isBuild,
    auth: true,
    essentials: true,
    translations: true
  })
```

## Step 7 | Use translations in your code

This step shows how to display translated content in your app using the `getTranslationFunction()` method.

At the end of this step, your app displays content in the visitor's preferred language.

To use translations in your code:

1. Import `i18n` from the `@wix/essentials` package:

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

2. Initialize a translation helper function. The `getTranslationFunction()` method detects the site visitor's selected language and returns the appropriate translation.

    ```javascript
    export const useTranslation = () => {
      const t = i18n.getTranslationFunction();
      return { t }
    };
    ```

3. In your page component file, call `useTranslation()` to get the translation function, and then get the translated text using a key path from your `translations.json` file:

    ```javascript
    const { t } = useTranslation();
    const heroTitle = t('hero.title');
    ```

**Full code example**

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

export const useTranslation = () => {
  const t = i18n.getTranslationFunction();
  return { t }
};

// Call useTranslation() to get the translation function
const { t } = useTranslation();

// Get translated text using the key path from the translation.json file
const heroTitle = t('hero.title');
```

Site visitors can now view your content in their preferred language.

## Display Wix-managed pages in a specific language

The steps above translate content on your headless site. Wix-managed pages, such as the login page and checkout, use a separate mechanism.

When you redirect visitors to a Wix-managed page with [Create Redirect Session](https://dev.wix.com/docs/api-reference/business-management/headless/redirects/create-redirect-session.md), set the page language in `preferences.additionalQueryParameters.lang` using an [ISO 639 language code](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes). For example, pass `"es"` for Spanish or `"fr"` for French.

Alternatively, send the `x-wix-linguist` header on the Create Redirect Session request. If you don't set `lang` explicitly, Wix adds the header value to the redirect URL as `lang`. If you set both, `lang` takes priority.

This applies to any Wix-managed page you open through a redirect session, including the [Wix login page](https://dev.wix.com/docs/go-headless/authentication/members/wix-login-page/add-a-wix-login-page-rest.md).

Before you set the language, make sure the [Wix Multilingual](https://www.wix.com/app-market/web-solution/wix-multilingual) app is installed on a site and the target language is enabled in the **Multilingual** dashboard.

```json
{
  "auth": {
    "authRequest": {
      "redirectUri": "https://example.com/callback",
      "clientId": "<CLIENT_ID>",
      "codeChallenge": "<CODE_CHALLENGE>",
      "codeChallengeMethod": "S256",
      "responseMode": "fragment",
      "responseType": "code",
      "scope": "offline_access",
      "state": "<STATE>"
    }
  },
  "preferences": {
    "additionalQueryParameters": {
      "lang": "es"
    }
  }
}
```

## SEO for secondary-language main pages

This article covers translating the content you render yourself. It doesn't cover SEO tags, such as titles and meta descriptions, which Wix manages separately for [main pages](https://dev.wix.com/docs/go-headless/wix-managed-headless/full-integration-astro/feature-guides/seo/manage-seo-for-main-pages.md). Main-page SEO isn't currently language-specific: see [Manage SEO for Main Pages: Multilingual sites](https://dev.wix.com/docs/go-headless/wix-managed-headless/full-integration-astro/feature-guides/seo/manage-seo-for-main-pages.md) before relying on a secondary-language route's SEO tags.

## See also

- [About the Multilingual APIs](https://dev.wix.com/docs/api-reference/business-management/multilingual/introduction.md)
- [Create Redirect Session](https://dev.wix.com/docs/api-reference/business-management/headless/redirects/create-redirect-session.md)
- [Add a Wix Login Page (REST)](https://dev.wix.com/docs/go-headless/authentication/members/wix-login-page/add-a-wix-login-page-rest.md)
- [Wix Multilingual: Using the Translation Manager](https://support.wix.com/en/article/wix-multilingual-using-the-translation-manager)