Machine Translate: Sample Use Case and Flow

This article shares a possible use case your app could support, as well as a sample flow that could support the use case. This can be a helpful jumping off point as you plan your app's implementation.

Translate a blog post

Many businesses maintain blogs to increase their online presence and visibility, establish their expertise in the industry, and drive more traffic to their website. A business may want to translate their blog posts to other languages and your app can use machine translation to render text from one language to another.

To translate a blog post:

  1. Retrieve a blog post using the Wix Blog API.

  2. Check the length of the post.

  3. If the length is under 5,000 characters: Use Machine Translate to translate the text of the post.

  4. If the length is over 5,000 characters:

    a. Parse it into units of 5,000 characters or less. Make sure not to end any unit in the middle of a sentence.

    b. Use Bulk Machine Translate to translate all the units of text.

    c. Append the translated text back into a single unit.

  5. Return the translated content.

Did this help?