machineTranslate( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

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 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, starting at 3,000 words. Each successful translation request reduces 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. Additional credits can be purchased through the Dashboard.

To translate up to 1,000 translatableContent units at once, use Bulk Machine Translate.

Method Declaration
Copy
Method Parameters
sourceLanguageSupportedLanguageRequired

Language of the source text to translate.


optionsMachineTranslateOptionsRequired
Returns
Return Type:Promise<MachineTranslateResponse>
Did this help?