DocumentationAIFunctions

Translate Rich Text JSON

amerta


amerta / AI Translate / translateRichTextJSON

Function: translateRichTextJSON()

translateRichTextJSON(json, targetLang): Promise<any>

Defined in: amerta/theme/utilities/ai-translate.ts:120

Translates all "text" fields in a rich text JSON object to the specified target language using Gemini AI.

Parameters

| Parameter | Type | Description | | ------ | ------ | ------ | | json | any | The rich text JSON object to translate. | | targetLang | string | The target language code (e.g., 'fr', 'de'). |

Returns

Promise<any>

The translated JSON object.

Example

const translated = await translateRichTextJSON({ text: "Hello" }, "de");