Translate Image
Translator
The Translator class is the core component of the lara-sdk, designed for translating text. 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
Translates image from a source language to a target language. It supports context-aware translations and adaptation to specific translation memories, it returns a translated image.
Request
// Sdk available soon
const res = await lara.images.translate('path/to/image.jpg', 'en-US', 'it-IT', {
adaptTo: ['mem_1_id', 'mem_2_id'],
glossaries: ['gls_1_id', 'gls_2_id'],
instructions: ['Be formal'],
style: 'fluid'
});// 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 / imagePath | File / String | Yes | The input image/the path to input image to translate. | |
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 | ImageTranslationOptions | No | See the table below for details. |
Several 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:
|
textRemoval | String | No |
| Customize how the original text is removed from the image. |
Translate text image
Translates the text inside an image from a source language to a target language. It supports context-aware translations and adaptation to specific translation memories, it returns the original and the translated text.
Request
// Sdk available soon
const res = await lara.images.translate_text('path/to/image.jpg', 'en-US', 'it-IT', {
adaptTo: ['mem_1_id', 'mem_2_id'],
glossaries: ['gls_1_id', 'gls_2_id'],
instructions: ['Be formal'],
style: 'fluid'
});// 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 translateText method:
Field | Type | Required | Default | Description |
|---|---|---|---|---|
file / imagePath | File / String | Yes | The input image/the path to input image to translate. | |
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 | ImageTextTranslationOptions | No | See the table below for details. |
Several options are available to customize the behavior of the translateText 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:
|
Response
// Sdk available soon
TextResult(
translation=[
Paragraphs(text="Hello, how are you?",translation = "Ciao, come stai?"),
Paragraphs(text="What a wonderful day",translation = "Che giornata meravigliosa.")
]
)// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
// Sdk available soon
Supported languages
Billing
Details are available in the pricing page
Updated about 5 hours ago
