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.

  1. Upload the audio file
  2. Wait for Lara to finish the process, polling the status at regular intervals until it changes to translated
  3. 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

FieldTypeDescription
idStringUnique ID of the document. Format: doc_xyz123
statusStringThe current status of the translation.
sourceStringThe source language of the document.
targetStringThe target language of the translation.
filenameStringFilename of the source file.
createdAtDateTimeWhen the document is created.
updatedAtDateTimeWhen the document is last updated (equal to created_at with no updates).
optionsAudioOptionsOptions related to the document translation.
translatedSecondsIntegerThe number of translated seconds.
totalSecondsIntegerThe number of seconds in the document.
errorReasonStringThe 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

faithful

The style to apply to the translation. Available values: faithful fluid creative

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

faithful

The style to apply to the translation. Available values: faithful fluid creative

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 upload method.

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 upload method.

Supported Languages

  • Afrikaans - af-ZA
  • Albanian - sq-AL
  • Amharic - am-ET
  • Arabic - ar-SA Armenian - hy-AM
  • Azerbaijani - az-AZ
  • Basque - eu-ES
  • Bengali - bn-BD Bulgarian - bg-BG
  • Burmese - my-MM
  • Catalan - ca-ES
  • Chinese (Simplified) - zh-CN
  • Chinese (Traditional, Hong Kong) - zh-HK
  • Croatian - hr-HR
  • Czech - cs-CZ
  • Danish - da-DK
  • Dutch - nl-NL
  • English (Australia) - en-AU
  • English (Canada) - en-CA
  • English (Ireland) - en-IE
  • English (United Kingdom) - en-GB
  • English (United States) - en-US
  • Estonian - et-EE
  • Filipino - fil-PH
  • Finnish - fi-FI
  • French - fr-FR
  • Galician - gl-ES
  • Georgian - ka-GE
  • German - de-DE
  • Hebrew - he-IL
  • Hindi - hi-IN
  • Hungarian - hu-HU
  • Icelandic - is-IS
  • Indonesian - id-ID
  • Irish - ga-IE
  • Italian - it-IT
  • Japanese - ja-JP
  • Javanese - jv-ID
  • Kazakh - kk-KZ
  • Korean - ko-KR
  • Lao - lo-LA
  • Latvian - lv-LV
  • Lithuanian - lt-LT
  • Macedonian - mk-MK
  • Malay - ms-MY
  • Malayalam - ml-IN
  • Maltese - mt-MT
  • Marathi - mr-IN
  • Mongolian - mn-MN
  • Norwegian Bokmål - nb-NO
  • Pashto - ps-PK Persian - fa-IR
  • Polish - pl-PL
  • Portuguese (Brazil) - pt-BR
  • Portuguese (Portugal) - pt-PT
  • Romanian - ro-RO
  • Russian - ru-RU
  • Serbian (Cyrillic script) - sr-Cyrl-RS Slovak - sk-SK
  • Slovenian - sl-SI
  • Somali - so-SO
  • Spanish - es-ES
  • Spanish (Argentina) - es-AR
  • Spanish (Latin America) - es-419 Spanish (Mexico) - es-MX
  • Swahili - sw-KE
  • Swedish - sv-SE
  • Tagalog - tl-PH Tamil - ta-IN
  • Thai - th-TH
  • Turkish - tr-TR
  • Ukrainian - uk-UA
  • Urdu - ur-PK Uzbek - uzn-UZ
  • Vietnamese - vi-VN
  • Welsh - cy-GB
  • Billing

    More details are available in the pricing page