> 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

# Method name: machineTranslate(sourceLanguage: SupportedLanguage, options: MachineTranslateOptions)

# Method package: wixMultilingualV2

# Method menu location: wixMultilingualV2 --> machineTranslation --> machineTranslate

# Method Link: https://dev.wix.com/docs/velo/apis/wix-multilingual-v2/machine-translation/machine-translate.md

# Method Description:

Translates the text of a translatable unit of content from one supported language to another.

The `translatedContent` object returns with the same `id` used for `contentToTranslate.id` but the text within the
content fields is replaced with the translated text. Note that Wix does not overwrite the original content object.
To retrieve the translated content later, make sure to store it separately.

Only text content is translated, even if the content is `htmlContent` or `richContent`. Note that [collapsible text](https://support.wix.com/en/article/adding-and-setting-up-collapsible-text)
cannot be translated using this method.

The translatable content must not exceed 5,000 characters. If this limit is exceeded, the method returns a `TEXT_TOO_LONG` error.
For `richContent`, the 5,000-character limit applies separately to each node in `richContent.nodes`.
The total translatable content may be more than 5,000 characters as long as no individual node surpasses this limit.
If any node exceeds 5,000 characters, the entire request fails.

Each site has a word credit balance indicating the number of words available for translation. Successful translation requests reduce the word credits by the number of words in `contentToTranslate`.
If the site does not have sufficient word credits to translate all of the text in the request, the request fails
with a `NOT_ENOUGH_CREDITS` error. You can also call the [Credit Data API](https://dev.wix.com/docs/rest/business-management/multilingual/machine-translation/credit-data/introduction.md)'s [Check Sufficient Credits](https://dev.wix.com/docs/rest/business-management/multilingual/machine-translation/credit-data/check-sufficient-credits.md) method at any time to check whether the site has enough credits to translate the specified number of words.
Wix users can receive additional word credits by [purchasing a translation package](https://support.wix.com/en/article/wix-multilingual-auto-translating-your-site#purchasing-translation-packages) in the [Translation Manager](https://support.wix.com/en/article/wix-multilingual-using-the-translation-manager) at any time.

To translate up to 1,000 `translatableContent` units at once, use [Bulk Machine Translate](/machine-translation/bulk-machine-translate).



# Method Code Examples:

*** Note: do not assume any prop names or enum values other than the ones in the example.

## machineTranslate example for dashboard page code

```javascript
import { machineTranslation } from 'wix-multilingual.v2';

async function machineTranslate(sourceLanguage, options) {
  try {
    const result = await machineTranslation.machineTranslate(sourceLanguage, options);
    return result;
  } catch (error) {
    console.error(error);
    // Handle the error
  }
}

```

## machineTranslate example for exporting from backend code

```javascript
import { machineTranslation } from 'wix-multilingual.v2';
import { webMethod, Permissions } from 'wix-web-module';
import { elevate } from 'wix-auth';

const elevatedMachineTranslate = elevate(machineTranslation.machineTranslate);

export const machineTranslate = webMethod(
  Permissions.Anyone,
  async (sourceLanguage, options) => {
    try {
      const result = await elevatedMachineTranslate(sourceLanguage, options);
      return result;
    } catch (error) {
      console.error(error);
      // Handle the error
    }
  }
);

```

---