Translation method - Fluid Topics - Latest

Fluid Topics Designer Guide

Category
Reference Guides
Audience
public
Version
Latest

The FluidTopicsTranslationService.translate() method allows designers to perform translations in Custom components.

It has the following properties:

Field Type Required? Description
profileId String Yes An AI profile ID of type TRANSLATION.
sourceLanguage String No The language of the content to translate. If omitted, Fluid Topics uses the ft:locale value of the topic, or otherwise the translation engine infers it.
destinationLanguage String Yes The language to translate the topic or content into.
format String No The format of the content and the translation. Can be html or text. If omitted, it is text.
content String One of content or topic A string to translate.
If both content and topic exist, Fluid Topics translates the topic.
topic Object One of content or topic Information about the topic to translate.
If both content and topic exist, Fluid Topics translates the topic.
mapId String Yes, with topic The identifier of the map to translate.
tocId String Yes, with topic The identifier of the topic to translate.
titleElement Element No An HTML element that contains the topic's translated title. Use the querySelector() method to select it. Fluid Topics escapes the content of the response.
contentElement Element No An HTML element that contains the topic's translated content. Use the querySelector() method to select it. Fluid Topics escapes the content of the response.
loaderElement Element No An HTML element that appears while waiting for the translation engine's response. Use the querySelector() method to select it.
errorElement Element No An HTML element that contains a possible error response by the translation engine. Use the querySelector() method to select it.

The function returns an object, which contains the following fields:

Field Type Description
content String The translated content. If a topic was translated, content contains the topic's HTML content, translated into the language set in destinationLanguage.
title String If a topic was translated, title contains the topic's translated title.

For translating a document in its entirety, use the On-demand translation component.