> 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`).
> - 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: Sample Flows

## Article: Sample Flows

## Article Link: https://dev.wix.com/docs/api-reference/business-management/multilingual/machine-translation/async-site-translator/sample-flows.md

## Article Content:

# Async Site Translator: Sample Flows

This article presents possible use cases and corresponding sample flows that you can support. It
provides a useful starting point as you plan your implementation.

## Translate a site's untranslated content

A site owner has added a secondary language to their site and wants everything that hasn't been
translated yet rendered in it, without paying to re-translate content they've already handled.

> **Prerequisite:** Install the [Wix Multilingual app](https://www.wix.com/app-market/wix-multilingual?searchLocation=home) on the site before using this API.

To translate a site's untranslated content:

1. Optionally, call [Check Sufficient Credits](https://dev.wix.com/docs/api-reference/business-management/multilingual/machine-translation/credit-data/check-sufficient-credits.md) with the number of words you expect to translate, so you can warn the site owner before starting a job that would fail.
1. Call [Translate Site](https://dev.wix.com/docs/api-reference/business-management/multilingual/machine-translation/async-site-translator/translate-site.md) with the site's primary locale as `mainLocale`, the locale to translate into as `translatedLocale`, and `filterByStatus` set to `UNTRANSLATED_ONLY`.
1. Store the `jobId` from the response.
1. Poll [Get Translation Job Status](https://dev.wix.com/docs/api-reference/business-management/multilingual/machine-translation/async-site-translator/get-translation-job-status.md) with that `jobId` until `jobState` is `COMPLETED` or `FAILED`.
1. Read `failedFields` and show each `failureReason` to the site owner, so they can fix the content and run another job for it.

## Refresh translations after content changes

When a site owner edits content that was already translated, those translations become outdated.
Rather than re-translating the whole site, you can pick up only what changed.

To refresh outdated translations:

1. Call [Translate Site](https://dev.wix.com/docs/api-reference/business-management/multilingual/machine-translation/async-site-translator/translate-site.md) with `filterByStatus` set to `OUTDATED_ONLY`, so the job covers only fields whose source content changed after they were translated.
1. Store the `jobId` from the response.
1. Poll [Get Translation Job Status](https://dev.wix.com/docs/api-reference/business-management/multilingual/machine-translation/async-site-translator/get-translation-job-status.md) until `jobState` is `COMPLETED` or `FAILED`.
1. To cover content that was never translated in the same job, use `UNTRANSLATED_AND_OUTDATED` instead of `OUTDATED_ONLY` in step 1.

## Translate one section of a site

A site owner wants to translate a single collection, such as their product catalog, rather than
everything on the site. Narrow the job with the `filter` field.

To translate one section of a site:

1. Call [List Site Schemas](https://dev.wix.com/docs/api-reference/business-management/multilingual/translation/translation-schema/list-site-schemas.md) to find the schema whose content you want to translate, and take its `id`.
1. Call [Translate Site](https://dev.wix.com/docs/api-reference/business-management/multilingual/machine-translation/async-site-translator/translate-site.md) with that schema in the filter:

    ```json
    {
      "mainLocale": "en-US",
      "translatedLocale": "de-DE",
      "filterByStatus": "UNTRANSLATED_ONLY",
      "filter": { "schemaId": "a4caeb4e-81ce-4921-a8d3-1f58329acfc5" }
    }
    ```

1. Store the `jobId` from the response.
1. Poll [Get Translation Job Status](https://dev.wix.com/docs/api-reference/business-management/multilingual/machine-translation/async-site-translator/get-translation-job-status.md) until `jobState` is `COMPLETED` or `FAILED`.

To narrow the job further to specific items rather than a whole schema, filter on entity IDs
instead, using `{"entityId": {"$in": ["<ID_1>", "<ID_2>"]}}`. Don't include a `locale` key in the
filter: the job already scopes itself to `mainLocale`, and your own `locale` value overrides that
scoping.