Author Aide API Methods
translate()
Programmatically triggers the translation functionality for specified Items to a destination language.
You would want to use this method to translate existing Items from your own custom interface or automation scripts, for example.
Important Before calling this method, ensure the Author Aide application is properly initialized and the specified Item references are valid and accessible.
Examples
// Basic usage - translate single Item
const itemRefs = ['73d00b19-41b9-4ad0-8848-0d1f82d5f498'];
const targetLanguage = 'French';
try {
const success = await authorAideApp.translate(itemRefs, targetLanguage);
if (success) {
console.log('Translation started successfully');
} else {
console.log('Translation failed - check Item references and language code');
}
} catch (error) {
console.error('Translation error:', error);
}
Arguments
-
itemReferences array[string]
An array of Item reference strings to be translated.
Each string should be a valid Item reference that exists in your Item bank.
-
destinationLanguage string
The target language code for translation.
Must be a valid language code supported by the translation service.
Return value
Type Promise
Returns a Promise that resolves with true if translation was successfully initiated.
Returns a Promise that resolves with false if translation failed due to validation errors, network errors, or invalid application state.
Note The Promise resolves when the translation process is initiated, not when it completes. Monitor save events for completion status.
Caveats
The method will return a rejected Promise if any Item references are invalid, network errors occur, or the application is not in a valid state for translation.
Translation operations may take time to complete depending on the content size and complexity.