Translate Audio
Translator
The Translator class is the core component of the lara-sdk, designed for translating text and documents. It must be initialized with authentication credentials.
// Sdk available soon
import {Credentials, Translator} from "@translated/lara";
const LARA_ACCESS_KEY_ID: string = "your-access-key-id";
const LARA_ACCESS_KEY_SECRET: string = "your-access-key-secret";
// Initialization of the Translator class
const credentials = new Credentials(LARA_ACCESS_KEY_ID, LARA_ACCESS_KEY_SECRET)
const lara: Translator = new Translator(credentials);// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
Translate audio file
All audio translation functionalities can be accessed via the same Translator (lara in the example) object of the above example, through the AudioTranslator class.
Audio translation is an asynchronous process consisting of three phases.
- Upload the audio file
- Wait for Lara to finish the process, polling the status at regular intervals until it changes to
translated - Download the file
For your convenience the SDK includes a translate method that takes care of the entire process.
Once uploaded with the upload method, Lara will return a Audio object; the id of this object can be used both to check the status with the status method, both to download the translated file with the download method once its status became translated.
Audio object
| Field | Type | Description |
|---|---|---|
| id | String | Unique ID of the document. Format: doc_xyz123 |
| status | String | The current status of the translation. |
| source | String | The source language of the document. |
| target | String | The target language of the translation. |
| filename | String | Filename of the source file. |
| createdAt | DateTime | When the document is created. |
| updatedAt | DateTime | When the document is last updated (equal to created_at with no updates). |
| options | AudioOptions | Options related to the document translation. |
| translatedSeconds | Integer | The number of translated seconds. |
| totalSeconds | Integer | The number of seconds in the document. |
| errorReason | String | The reason of the error, if any. |
Translate method
The SDK contains a translate method that simplifies the process of translating audio file by uploading the file, checking the status at regular intervals, and returning the result of the download function.
Request
// Sdk available soon
const options: AudioTranslateOptions = {
adaptTo: ['mem_1_id', 'mem_2_id'],
glossaries: ['gls_1_id', 'gls_2_id'],
style: 'fluid'
};
// Translate an audio file
const translation = await lara.audio.translate(file, 'test.wav', 'en', 'it', options);// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
Here follows the basic fields for the translate method:
Field | Type | Required | Default | Description |
|---|---|---|---|---|
file / filePath | File / String | Yes | The input file/the path to input file to translate. | |
filename | String | Yes* | Only the Typescript/Javascript SDK requires the filename as parameter. | |
source | String | No | Autodetected | The source language code (e.g., "en-EN" for English). If not specified, the system will attempt to detect it automatically. |
target | String | Yes | The target language code (e.g., "it-IT" for Italian). This specifies the language you want the text translated into. | |
options | AudioTranslateOptions | No | See the table below for details. |
Some options are available to customize the behavior of the translate method:
Field | Type | Required | Default | Description |
|---|---|---|---|---|
adaptTo | String[] | No | Default is all Memories on your account | A list of translation memory IDs for adapting the translation. |
glossaries | String[] | No | A list of glossary IDs. | |
noTrace | Boolean | No | False | If set to True, source content and its translation will not be saved on our system. (AKA Incognito mode) |
style | String | No |
| The style to apply to the translation. Available values:
|
The following sections provide a detailed breakdown of the phases and methods utilized by the translate method.
Upload an audio file
The upload method will take care of uploading the source file to Lara and starting the translation process.
Request
// Sdk available soon
const options: AudioUploadOptions = {
adaptTo: ['mem_1_id', 'mem_2_id'],
glossaries: ['gls_1_id', 'gls_2_id'],
style: 'fluid',
};
// Upload an audio file and start the translation process
const audio: Audio = await lara.audio.upload(file, 'test.wav', 'en', 'it', options);// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
Here follows the basic fields for the upload method:
Field | Type | Required | Default | Description |
|---|---|---|---|---|
file | File | Yes | The input file to translate. | |
filename | String | Yes* | The Typescript/Javascript and Python SDKs require the filename as a parameter. | |
source | String | No | Autodetected | The source language code (e.g., "en-EN" for English). If not specified, the system will attempt to detect it automatically. |
target | String | Yes | The target language code (e.g., "it-IT" for Italian). This specifies the language you want the text translated into. | |
options | AudioUploadOptions | No | See the table below for details. |
There are some options available to customize the behavior of the upload method:
Field | Type | Required | Default | Description |
|---|---|---|---|---|
adaptTo | String[] | No | Default is all Memories on your account | A list of translation memory IDs for adapting the translation. |
glossaries | String[] | No | A list of glossary IDs. | |
noTrace | Boolean | No | False | If set to True, source content and its translation will not be saved on our system. |
style | String | No |
| The style to apply to the translation. Available values:
|
The result of the upload method is a Audio object that is needed to check the translation status and download the translated audio file.
Response
// Sdk available soon
// audio
{
status: 'initialized',
id: 'doc_3TJ2ObqnrYTC2k5vSfLlqz',
filename: 'test.wav',
updatedAt: 2025-05-15T09:28:14.626Z,
createdAt: 2025-05-15T09:28:14.626Z,
source: 'en',
target: 'it'
}// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
Check status
After the upload is finished, it is possible to check the status of the translation at regular intervals. This can be done with the status method:
Request
// Sdk available soon
// check the status of the audio file
audio = await lara.audio.status(audio.id);// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
The method takes as unique parameter the id of the Audio object obtained with the upload method.
Field | Type | Required | Default | Description |
|---|---|---|---|---|
id | String | Yes | The audio file id obtained with the |
Response
// Sdk available soon
// document
{
status: 'translated',
id: 'doc_3TJ2ObqnrYTC2k5vSfLlqz',
filename: 'test.txt',
updatedAt: 2025-05-15T09:28:22.347Z,
createdAt: 2025-05-15T09:28:14.626Z,
source: 'en',
target: 'it'
}// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
Download the translation
After updating the audio file status with the status method and setting it to translated, you can download the translated audio file with the download method.
Request
// Sdk available soon
const options: DocumentDownloadOptions = {
outputFormat: 'pdf'
}
// Download the translation:
const translation = await lara.documents.download(document.id, options);// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
Here follows the basic fields for the download method:
Field | Type | Required | Default | Description |
|---|---|---|---|---|
id | String | Yes | The id of the document obtained with the |
Supported Languages
Billing
More details are available in the pricing page
Updated about 5 hours ago
