DocumentationAIFunctions

Batch Translate

amerta


amerta / AI Translate / batchTranslate

Function: batchTranslate()

batchTranslate(items, targetLocale): Promise<any>

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

Translates all values in a JSON object to the specified target language using Gemini AI.

Parameters

| Parameter | Type | Description | | ------ | ------ | ------ | | items | Record<string, string> | A record object with string keys and string values to translate. | | targetLocale | string | The target language code (e.g., 'fr', 'de'). |

Returns

Promise<any>

A promise resolving to the translated JSON object with the same structure.

Example

const translated = await batchTranslate({ greeting: "Hello", farewell: "Goodbye" }, "fr");