Translating Content with AI Hub

Translate Content, a built-in AI Hub agent, translates the content open in the Liferay CMS editor into one or more languages, writing each translation into the fields for that language. Use it while you edit an item that supports translations. See Agents.

Liferay translates from the language currently selected in the editor’s language picker, so switch to the language you’re translating from before you start.

Prerequisites

An administrator must complete three setup tasks before the Auto Translate With AI button appears in your editor:

  1. Enable AI Hub and connect it to your Liferay DXP instance. See Integrating AI Hub with Liferay DXP.

  2. Disable any other translation service.

  3. Enable Translator Using AI Hub in System Settings. See Using Third Parties for Translation.

If you don’t see the Auto Translate With AI button: First check that you’re in the Liferay CMS editor, which you reach by opening the Global Menu and clicking CMS. Classic CMS applications such as Web Content and Blogs don’t show the button. If you’re in the right editor, ask your administrator to enable AI Hub and Translator Using AI Hub. The Enabling Translator Using AI Hub section names each step.

Using the Auto Translate With AI Button

The Auto Translate With AI (Auto Translate With AI) button beside the language picker starts the translation. It appears only while Translator Using AI Hub is the active translation provider, and only in the Liferay CMS editor. There, it replaces the Auto Translate action that the other translation providers add to the Localization Actions menu. Classic CMS editors, such as Web Content and Blogs, don’t show it, even when Translator Using AI Hub is enabled.

The Auto Translate With AI icon sits beside the language picker in the Liferay CMS editor.

Follow these steps to translate the content open in the editor:

  1. Open the item you want to translate in the editor, and use the language picker to select the language you’re translating from.

  2. Click Auto Translate With AI (Auto Translate With AI) beside the language picker.

    Hovering the icon beside the language picker shows the Auto Translate With AI tooltip.

    The AI Assistant opens and submits the request for you, then asks which languages to translate into.

  3. In Select Languages, choose one or more target languages.

    The list shows every language your Liferay DXP instance offers, as language IDs such as es_ES. A site can offer fewer languages than the instance, so a language you select here may not appear in the editor’s language picker. If one is missing, ask your administrator to add it to the site.

  4. Click Translate.

    This button appears once you select at least one language. If none of the selected languages has a translation, the translation runs. If one or more of them already has a translation, the AI Assistant asks what to do before translating. See Overwriting Existing Translations.

  5. Wait for the AI Assistant to report “The content has been translated.”

  6. Switch the language picker to one of the languages you selected, and confirm the fields show the translation.

  7. Click Save as Draft or Publish.

    The AI Assistant doesn’t save the translations for you.

Reviewing the Translations in the Editor

The editor shows a field’s translation only for the language you’re viewing. If you translate into three languages while viewing English, the English fields stay as they are. An unchanged field doesn’t mean the translation failed. To read a translation, open the language picker and select a language you translated into.

The picker also reports each language’s translation status. Your default language shows Default. A language whose fields are all translated shows Translated, a language with no translations shows Not Translated, and one in between shows a count of translated fields, such as Translating 1/3. The count can stay below the total even after translation finishes, because Liferay skips fields that are empty in the language you’re translating from, and because the total counts every localizable field, including types the agent doesn’t translate, such as images.

Switch the picker back to your original language before you translate again, so the next translation starts from the language you intend.

Overwriting Existing Translations

When one or more of the languages you select already has a translation, the AI Assistant asks “Some of the selected languages already have a translation. What do you want to do?” and offers these choices:

  • Overwrite All translates every language you selected, replacing any translation those languages already have. To keep some of them, click Review instead.

  • Review shows a checkbox for each language that already has a translation, so you can choose which to overwrite and which to keep.

Follow these steps to replace some translations and keep others:

  1. Click Review.

    The AI Assistant shows “Select the translations you want to overwrite” and a checkbox for each language that already has a translation, with all of them selected.

  2. Clear the checkbox for each translation you want to keep.

  3. Click Overwrite.

Clearing a checkbox keeps that language’s existing translation, and Liferay replaces the translation for each language you leave checked. Whichever option you choose, Liferay also translates any language you chose in Select Languages that has no translation yet. The AI Assistant replaces nothing until you click Overwrite All or Overwrite, and then reports “The content has been translated.”

Then continue with the remaining steps in Using the Auto Translate With AI Button to confirm the translations and save them.

Requesting a Translation from the Chat

You can start the same flow from the AI Assistant chat rather than from the button.

  1. Open the AI Assistant. See Using the AI Assistant.

  2. Enter a request that names the languages you want, such as “translate this to Spanish”.

    Liferay matches your wording against each available language’s language ID and its display language, so “translate this to Spanish” selects every Spanish language your instance offers, such as es_ES and es_MX. Only languages your instance offers are selected, so check the selection before you continue.

  3. Review the selected languages and click Translate.

Then continue with the remaining steps in Using the Auto Translate With AI Button to confirm the translations and save them.

Fields Liferay Translates

Translation covers localizable Text, Long Text, and Rich Text fields.

In a rich text field, Liferay translates only the human-readable text. Tags, attributes, and URLs stay as they are.