Translate Text
Lara offers two translation modes optimized for different needs: Lara Think for maximum translation quality, and Lara Base for speed and real-time performance.
Lara Think is designed for professional translation and localization workflows where translation quality takes priority over speed and cost. It applies deeper linguistic reasoning to the source content and available context, delivering translations that approach human translation quality across many use cases. To give you precise control over this process, Lara Think allows you to set a reasoning effort across three levels (low, medium, and high), letting you balance the depth of linguistic analysis. Additionally, you can now provide an image as context, equipping the engine with visual references to further enhance the accuracy of the localized output.
By reducing the amount of content that requires human revision, Lara Think can significantly lower post-editing effort, costs, and time to market.
Lara Base is Lara’s best-in-class machine translation model, optimized for speed, low latency, and high-throughput applications. It delivers high-quality translations quickly, making it the recommended choice for real-time experiences and workflows where immediate results matter.
Lara Prosa could be applied in post-processing after Base. It refines the output according to a style guide, preserving meaning, terminology, and consistency. It is the right choice when the final text must respect a brand voice, an authorial style, or a specific editorial standard.
Translate
To begin, you must first instantiate the Translator class. This is the mandatory first step for all operations within the Lara SDK.
Translates text from a source language to a target language. It supports single-sentence translations, context-aware translations and adaptation to specific translation memories.
Request
res = lara.translate('Hello, how are you?',
source='en-US',
target='it-IT',
profanitiesDetect: "source_target",
profanitiesHandling: "detect",
adapt_to=['mem_1_id', 'mem_2_id'],
glossaries=['gls_1_id', 'gls_2_id'],
instructions=['Be formal'],
style="fluid",
content_type='text/plain',
timeout_ms=2000,
priority=TranslatePriority.NORMAL,
)
print(res.translation)const res = await lara.translate('Hello, how are you?', 'en-US', 'it-IT', {
adaptTo: ['mem_1_id', 'mem_2_id'],
glossaries: ['gls_1_id', 'gls_2_id'],
instructions: ['Be formal'],
profanitiesDetect: "source_target",
profanitiesHandling: "detect",
style: 'fluid',
contentType: 'text/plain',
timeoutInMillis: 2000,
priority: 'normal'
});// All options are optional and can be omitted
TranslateOptions options = new TranslateOptions();
options.setAdaptTo("mem_1_id", "mem_2_id");
options.setGlossaries("gls_1_id", "gls_2_id");
options.setInstructions("Be formal");
options.setProfanitiesDetect(ProfanitiesDetect.SOURCE_TARGET)
options.setProfanitiesHandling(ProfanitiesHandling.DETECT);
options.setStyle(TranslationStyle.FLUID);
options.setContentType("text/plain");
options.setTimeoutMs(2000);
options.setPriority(TranslateOptions.Priority.NORMAL);
TextResult res = lara.translate("Hello, how are you?", "en-US", "it-IT", options);$options = new TranslateOptions([
'adaptTo' => array('mem_1_id', 'mem_2_id'),
'glossaries' => array('gls_1_id', 'gls_2_id'),
'instructions' => array('Be formal'),
'style' => 'fluid',
'contentType' => 'text/plain',
'timeoutInMillis' => 2000,
'priority' => 'normal'
]);
$res = $lara->translate('Hello, how are you?', 'en-US', 'it-IT', $options);res, _ := lara.Translate("Hello, how are you?", "en-US", "it-IT",
lara_sdk.TranslateOptions{
Instructions: []string{"Be formal"},
Style: "fluid",
ContentType: "text/plain",
TimeoutMs: 2000,
Priority: "normal"
})
fmt.Println(*res.Translation.String)// All options are optional and can be omitted
val options = TranslateOptions().apply {
setAdaptTo("mem_1_id", "mem_2_id")
setGlossaries("gls_1_id", "gls_2_id")
setInstructions("Be formal")
setStyle(TranslationStyle.FLUID)
setContentType("text/plain")
setTimeoutMs(2000)
setPriority(TranslateOptions.Priority.NORMAL)
setUseCache(TranslateOptions.UseCache.YES)
setCacheTTL(86400)
}
val res: TextResult = lara.translate(
"Hello, how are you?",
"en-US",
"it-IT",
options
)var res = await lara.Translate(
"test example", "en-US", "it-IT",
new TranslateOptions {
Instructions = new[] { "Be formal" },
Style = TranslationStyle.Fluid,
ContentType = "text/plain",
TimeoutInMillis = 2000,
Priority = TranslatePriority.Normal,
});// All options are optional and can be omitted
let options = TranslateOptions()
.setAdaptTo(["mem_1_id", "mem_2_id"])
.setGlossaries(["gls_1_id", "gls_2_id"])
.setInstructions(["Be formal"])
.setStyle(.fluid)
.setContentType("text/plain")
.setTimeoutMs(2000)
.setPriority(.normal)
let res = try await lara.translate(text: "Hello, how are you?", source: "en-US", target: "it-IT", options: options)Here follows the basic fields for the translate method:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| text | String | String[] | TextBlock[] | Yes | The text to be translated. This can be a single string or a list (up to 128 elements) of strings or TextBlock objects for incremental translation.Use String[]orTextBlockstrictly for context-linked strings, not for batch translating unrelated texts. | |
| source | String | No | Autodetected | The source language code (e.g., "en-US" 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. |
Several options are available to customize the behavior of the translate method:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| source_hint | String | No | Used to guide language detection. Specify this when the source language is uncertain to improve detection accuracy. | |
| adapt_to | 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. | |
| instructions | String[] | No | [ ] | A list of instructions to adjust the network’s behavior regarding the output (e.g., "Use a formal tone"). If you plan to use instructions please carefully read here |
| reasoning | Boolean | No | False | Reasoning engine that improves translation quality |
| reasoningEffort | String | No | high | Defines the reasoning effort level. Available options: low, medium, high. |
| imageContext | ImageSchema | No | Optional image providing visual context for translation. Accepts an HTTPS URL or base64 data URL. Requires reasoning: true | |
| styleguideId | Integer | No | The ID of the style guide that will be used by Lara Prosa | |
| styleguideReasoning | Boolean | No | False | If set to true, Lara Prosa will be active in reasoning mode |
| styleguideExplanationLanguage | String | No | en | The language of the comments regarding the changes to the translation by Lara Prosa |
| profanitiesDetect | String | No | defines the scope of the profanity filtering. Available options: source_target target | |
| profanitiesHandling | String | No | hide | Specifies how Lara handles profanity in the translation. Available options: detect hide avoid |
| style | String | No | faithful | The style to apply to the translation. Available values: faithful fluid creative |
| content_type | String | No | Autodetected | Specifies the Content-Type of the text. Available values: text/plaintext/htmlapplication/xliff+xml |
| timeout_ms | Integer | No | None | Specifies the maximum allowable time (in milliseconds) to perform the translation. If the timeout is exceeded, a TimeoutException is raised. |
| priority | String | No | Normal | Specifies whether the translation should be executed as a normal priority task or can wait for other tasks to complete. |
| use_cache | Boolean | No | False | Specifies whether the translation should be saved in the cache for future retrieval. Note: Caching is an advanced feature and is not enabled by default. To enable caching for your account, please contact our . |
| cache_ttl | Integer | No | 2 Years | The time-to-live (TTL) for the cache entry, specifying how long the translation will remain in the cache. |
| verbose | Boolean | No | False | When enabled, this parameter returns additional debugging and metadata information from the engine, such as memory and glossary matches. Not recommended for production use, as it can significantly impact response times. |
| headers | List[String, String] | No | None | An optional object containing additional HTTP headers to include in the request. This field is primarily intended for debugging purposes and future extensibility. Use with caution. Custom headers are not required for standard usage and may be ignored or restricted by the server. |
| no_trace (see the snippet below for the correct syntax) | Boolean | No | False | If set to True, source content and its translation will not be saved on our system. (AKA Incognito mode) |
Incognito mode
res = lara.translate('Hello, how are you?',
source='en-US',
target='it-IT',
noTrace = true
)
print(res.translation)const res = await lara.translate('Hello, how are you?', 'en-US', 'it-IT', {
adaptTo: ['mem_1_id', 'mem_2_id'],
glossaries: ['gls_1_id', 'gls_2_id'],
no_trace: true
});// All options are optional and can be omitted
TranslateOptions options = new TranslateOptions();
options.setAdaptTo("mem_1_id", "mem_2_id");
options.setGlossaries("gls_1_id", "gls_2_id");
options.setNoTrace(true);
TextResult res = lara.translate("Hello, how are you?", "en-US", "it-IT", options);$options = new TranslateOptions([
'adaptTo' => array('mem_1_id', 'mem_2_id'),
'glossaries' => array('gls_1_id', 'gls_2_id'),
'noTrace' => true,
]);
$res = $lara->translate('Hello, how are you?', 'en-US', 'it-IT', $options);res, _ := lara.Translate("Hello, how are you?", "en-US", "it-IT",
lara_sdk.TranslateOptions{
Instructions: []string{"Be formal"},
Style: "fluid",
ContentType: "text/plain",
NoTrace: true
})
fmt.Println(*res.Translation.String)// All options are optional and can be omitted
val options = TranslateOptions().apply {
setAdaptTo("mem_1_id", "mem_2_id")
setGlossaries("gls_1_id", "gls_2_id")
setInstructions("Be formal")
setNoTrace(true)
}
val res: TextResult = lara.translate(
"Hello, how are you?",
"en-US",
"it-IT",
options
)var res = await lara.Translate(
"test example", "en-US", "it-IT",
new TranslateOptions {
Instructions = new[] { "Be formal" },
Style = TranslationStyle.Fluid,
NoTrace = true
});// All options are optional and can be omitted
let options = TranslateOptions()
.setAdaptTo(["mem_1_id", "mem_2_id"])
.setGlossaries(["gls_1_id", "gls_2_id"])
.setInstructions(["Be formal"])
.setNoTrace(true)
let res = try await lara.translate(text: "Hello, how are you?", source: "en-US", target: "it-IT", options: options)Image context with Lara Think
import base64
from pathlib import Path
from lara_sdk import Translator, Credentials, ImageContext
LARA_ACCESS_KEY_ID = "your-access-key-id"
LARA_ACCESS_KEY_SECRET = "your-access-key-secret"
# Initialization of the Translator class
credentials = Credentials(access_key_id=LARA_ACCESS_KEY_ID, access_key_secret=LARA_ACCESS_KEY_SECRET)
lara = Translator(credentials)
#direct HTTPS URL:
https_image = ImageContext(
url="https://example.com/image.png"
)
# Or you can use a local image converted to Base64
image_path = Path("screenshot.png")
base64_image = ImageContext(
url="data:image/png;base64," + base64.b64encode(image_path.read_bytes()).decode("ascii")
)
res = lara.translate(
text="Submit", # The ambiguous text to translate
source="en-US",
target="it-IT",
reasoning=True, # Mandatory: enable Lara Think
reasoningEffort="high", # Optional: set the reasoning effort level (low, medium, high)
imageContext=base64_image, # Pass the image to provide visual context for the translation
content_type="text/plain"
)
print(res.translation)import { readFileSync } from "node:fs";
import type { ImageContext, 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";
const credentials = new Credentials(LARA_ACCESS_KEY_ID, LARA_ACCESS_KEY_SECRET)
const lara: Translator = new Translator(credentials);
// Create the ImageContext object
// Example reading a local file in Base64:
const base64Image: ImageContext = {
url: `data:image/png;base64,${readFileSync("screenshot.png").toString("base64")}`
};
// Example using an HTTPS URL:
// const httpsImage: ImageContext = { url: "https://example.com/screenshot.png" };
// Execute the translation with Lara Think
async function translateWithContext() {
const res = await lara.translate(
"Submit",
"en-US",
"it-IT",
{
reasoning: true, // Mandatory: enable Lara Think
reasoningEffort: "high", // Optional: reasoning effort
imageContext: base64Image, // The visual context
contentType: "text/plain"
}
);
console.log(res.translation);
}
translateWithContext();import com.translated.lara.translator.Lara;
import com.translated.lara.translator.ImageContext;
import com.translated.lara.translator.TranslateOptions;
import com.translated.lara.translator.TextResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Base64;
public class LaraExample {
public static void main(String[] args) throws Exception {
// Initialize the client
private static final String LARA_ACCESS_KEY_ID = "your-access-key-id";
private static final String LARA_ACCESS_KEY_SECRET = "your-access-key-secret";
Credentials credentials = new Credentials(LARA_ACCESS_KEY_ID, LARA_ACCESS_KEY_SECRET);
Translator lara = new Translator(credentials);
// Create the ImageContext object
// Example using an HTTPS URL:
// ImageContext httpsImage = new ImageContext("https://example.com/screenshot.png");
// Example reading a local file in Base64:
ImageContext base64Image = new ImageContext(
"data:image/png;base64," + Base64.getEncoder().encodeToString(Files.readAllBytes(Path.of("screenshot.png")))
);
// Execute the translation with Lara Think
TranslateOptions options = new TranslateOptions();
options.setReasoning(true); // Mandatory: enable Lara Think
options.setReasoningEffort("high"); // Optional: set the reasoning effort level
options.setImageContext(base64Image); // Pass the image to provide visual context
options.setContentType("text/plain");
TextResult res = lara.translate("Submit", "en-US", "it-IT", options);
System.out.println(res.getTranslation());
}
}require 'vendor/autoload.php';
use Lara\Lara;
use Lara\ImageContext;
use Lara\Translator;
use Lara\LaraCredentials;
$LARA_ACCESS_KEY_ID = "your-access-key-id";
$LARA_ACCESS_KEY_SECRET = "your-access-key-secret";
// Initialization of the Translator class
$credentials = new LaraCredentials($LARA_ACCESS_KEY_ID, $LARA_ACCESS_KEY_SECRET);
$lara = new Translator($credentials);
// Create the ImageContext object
// Example using an HTTPS URL:
// $httpsImage = new ImageContext('https://example.com/screenshot.png');
// Example reading a local file in Base64:
$base64Image = new ImageContext(
'data:image/png;base64,' . base64_encode(file_get_contents('screenshot.png'))
);
// Execute the translation with Lara Think
$options = new TranslateOptions([
'reasoning' => true, // Mandatory: enable Lara Think
'reasoningEffort' => 'high', // Optional: set the reasoning effort level
'imageContext' => $base64Image, // The visual context
'contentType' => 'text/plain'
]);
$res = $lara->translate('Submit', 'en-US', 'it-IT', $options);
echo $res->translation;package main
import (
"encoding/base64"
"fmt"
"os"
"github.com/translated/lara-go" // Ensure you use the correct Lara SDK import path
)
const (LARA_ACCESS_KEY_ID = "your-access-key-id"
LARA_ACCESS_KEY_SECRET = "your-access-key-secret")
credentials := lara_sdk.NewCredentials(LARA_ACCESS_KEY_ID, LARA_ACCESS_KEY_SECRET)
lara := lara_sdk.NewTranslator(credentials, nil)
data, err := os.ReadFile("screenshot.png")
if err != nil {
panic(err)
}
// Example reading a local file in Base64:
base64Image := lara.ImageContext{
URL: "data:image/png;base64," + base64.StdEncoding.EncodeToString(data),
}
// Execute the translation with Lara Think
options := lara.TranslateOptions{
Reasoning: true, // Mandatory: enable Lara Think
ReasoningEffort: "high", // Optional: set the reasoning effort level
ImageContext: &base64Image, // Pass the image for visual context
ContentType: "text/plain",
}
res, err := client.Translate("Submit", "en-US", "it-IT", options)
if err != nil {
panic(err)
}
fmt.Println(*res.Translation.String)
import com.translated.lara.translator.ImageContext
import com.translated.lara.Credentials
import com.translated.lara.translator.Translator
import java.io.File
import java.util.Base64
private const val LARA_ACCESS_KEY_ID = "your-access-key-id"
private const val LARA_ACCESS_KEY_SECRET = "your-access-key-secret"
// Initialization of the Translator class
val credentials = Credentials(LARA_ACCESS_KEY_ID, LARA_ACCESS_KEY_SECRET)
val lara = Translator(credentials)
// Create the ImageContext object
// Example using an HTTPS URL:
// val httpsImage = ImageContext("https://example.com/screenshot.png")
// Example reading a local file in Base64:
val base64Image = ImageContext("data:image/png;base64," + Base64.getEncoder().encodeToString(File("screenshot.png").readBytes()))
// Execute the translation with Lara Think
val options = TranslateOptions().apply {
setReasoning(true) // Mandatory: enable Lara Think
setReasoningEffort("high") // Optional: reasoning effort
setImageContext(base64Image) // The visual context
setContentType("text/plain")
}
val res: TextResult = lara.translate("Submit", "en-US", "it-IT", options)
println(res.translation)using System;
using System.IO;
using Lara.Sdk;
using System.Threading.Tasks;
string accessKeyId = "your-access-key-id";
string accessKeySecret = "your-access-key-secret";
var credentials = new Credentials(accessKeyId, accessKeySecret);
var lara = new Translator(credentials);
// Initialize the client
var lara = new LaraClient(Environment.GetEnvironmentVariable("LARA_API_KEY"));
// Create the ImageContext object
// Example using an HTTPS URL:
// var httpsImage = new ImageContext("https://example.com/screenshot.png");
// Example reading a local file in Base64:
var base64Image = new ImageContext("data:image/png;base64," + Convert.ToBase64String(File.ReadAllBytes("screenshot.png"))
);
// Execute the translation with Lara Think
var options = new TranslateOptions
{
Reasoning = true, // Mandatory: enable Lara Think
ReasoningEffort = "high", // Optional: reasoning effort level
ImageContext = base64Image, // Visual context
ContentType = "text/plain"
};
var res = await lara.Translate("Submit", "en-US", "it-IT", options);
Console.WriteLine(res.Translation);import Foundation
import Lara
let LARA_ACCESS_KEY_ID = "your-access-key-id"
let LARA_ACCESS_KEY_SECRET = "your-access-key-secret"
// Initialization of the Translator class
let credentials = Credentials(accessKeyId: LARA_ACCESS_KEY_ID, accessKeySecret: LARA_ACCESS_KEY_SECRET)
let lara = Translator(credentials: credentials)
// Initialize the client
let apiKey = ProcessInfo.processInfo.environment["LARA_API_KEY"] ?? ""
let lara = Lara(apiKey: apiKey)
// Create the ImageContext object
// Example using an HTTPS URL:
// let httpsImage = ImageContext(url: "https://example.com/screenshot.png")
// Example reading a local file in Base64:
let encoded = try Data(contentsOf: URL(fileURLWithPath:"screenshot.png")).base64EncodedString()
let base64Image = ImageContext(url: "data:image/png;base64,\(encoded)")
// Execute the translation with Lara Think
let options = TranslateOptions()
.setReasoning(true) // Mandatory: enable Lara Think
.setReasoningEffort("high") // Optional: set the reasoning effort level
.setImageContext(base64Image) // Pass the image for visual context
.setContentType("text/plain")
do {
let res = try await lara.translate(
text: "Submit",
source: "en-US",
target: "it-IT",
options: options
)
print(res.translation)
} catch {
print("Translation failed: \(error)")
}Response
# Single string
TextResult(
content_type="text/plain",
source_language="en",
adapted_to=["mem_1_id", "mem_2_id"],
translation="Ciao, come stai?"
)
# String array
TextResult(
content_type="text/plain",
source_language="en",
adapted_to=["mem_1_id", "mem_2_id"],
translation=['Ciao, come stai?', 'Che giornata meravigliosa.']
)
# TextBlock array
TextResult(
content_type="text/plain",
source_language="en",
adapted_to=["mem_1_id", "mem_2_id"],
translation=[
TextBlock(text="Ciao, come stai?", translatable=True),
TextBlock(text="Che giornata meravigliosa.", translatable=True)
]
)// Single string
{
contentType: 'text/plain',
sourceLanguage: 'en-US',
translation: 'Salve, come sta?',
adaptedTo: [ 'mem_1_id', 'mem_2_id']
}
// String array
{
contentType: 'text/plain',
sourceLanguage: 'en-US',
translation: ['Salve, come sta?', 'Che bella giornata.'],
adaptedTo: [ 'mem_1_id', 'mem_2_id']
}
// TextBlock array
{
contentType: 'text/plain',
sourceLanguage: 'en-US',
translation: [
{ text: 'Salve, come sta?', translatable: true },
{ text: 'Che bella giornata.', translatable: true }
],
adaptedTo: [ 'mem_1_id', 'mem_2_id']
}// Single string
TextResult(
contentType="text/plain",
sourceLanguage="en",
adaptedTo=["mem_1_id", "mem_2_id"],
translation="Ciao, come stai?"
)
// String array
TextResult(
contentType="text/plain",
sourceLanguage="en",
adaptedTo=["mem_1_id", "mem_2_id"],
translation=['Ciao, come stai?', 'Che giornata meravigliosa.']
)
// TextBlock array
TextResult(
contentType="text/plain",
sourceLanguage="en",
adaptedTo=["mem_1_id", "mem_2_id"],
translation=[
TextBlock(text="Ciao, come stai?", translatable=true),
TextBlock(text="Che giornata meravigliosa.", translatable=true)
]
)// Single string
Lara\TextResult {
contentType: 'text/plain',
sourceLanguage: 'en-US',
translation: 'Salve, come sta?',
adaptedTo: [ 'mem_1_id', 'mem_2_id']
}
// String array
Lara\TextResult {
contentType: 'text/plain',
sourceLanguage: 'en-US',
translation: ['Salve, come sta?', 'Che bella giornata.'],
adaptedTo: [ 'mem_1_id', 'mem_2_id']
}
// TextBlock array
Lara\TextResult {
contentType: 'text/plain',
sourceLanguage: 'en-US',
translation: [
Lara\TextBlock { text: 'Salve, come sta?', translatable: true },
Lara\TextBlock { text: 'Che bella giornata.', translatable: true }
],
adaptedTo: [ 'mem_1_id', 'mem_2_id']
}// Single string
TextResult{
ContentType: "text/plain",
SourceLanguage: "en-US",
Translation: Translation{
String: &"Salve, come sta?",
},
AdaptedTo: []string{"mem_1_id", "mem_2_id"},
}
// String array
TextResult{
ContentType: "text/plain",
SourceLanguage: "en-US",
Translation: Translation{
Strings: []string{"Salve, come sta?", "Che bella giornata."},
},
AdaptedTo: []string{"mem_1_id", "mem_2_id"},
}
// TextBlock array
TextResult{
ContentType: "text/plain",
SourceLanguage: "en-US",
Translation: Translation{
TextBlocks: []TextBlock{
{Text: "Salve, come sta?", Translatable: true},
{Text: "Che bella giornata.", Translatable: true},
},
},
AdaptedTo: []string{"mem_1_id", "mem_2_id"},
}
// Single string
val single = TextResult(
contentType = "text/plain",
sourceLanguage = "en",
adaptedTo = listOf("mem_1_id", "mem_2_id"),
translation = "Ciao, come stai?"
)
// String array
val multipleStrings = TextResult(
contentType = "text/plain",
sourceLanguage = "en",
adaptedTo = listOf("mem_1_id", "mem_2_id"),
translation = listOf("Ciao, come stai?", "Che giornata meravigliosa.")
)
// TextBlock array
val textBlocks = TextResult(
contentType = "text/plain",
sourceLanguage = "en",
adaptedTo = listOf("mem_1_id", "mem_2_id"),
translation = listOf(
TextBlock(text = "Ciao, come stai?", translatable = true),
TextBlock(text = "Che giornata meravigliosa.", translatable = true)
)
)// Single string
TextResult(
ContentType = "text/plain",
SourceLanguage = "en",
AdaptedTo = new List<string> { "mem_1_id", "mem_2_id" },
Translation = "Ciao, come stai?"
)
// String array
TextResult(
ContentType = "text/plain",
SourceLanguage = "en",
AdaptedTo = new List<string> { "mem_1_id", "mem_2_id" },
Translation = new List<string> { "Ciao, come stai?", "Che giornata meravigliosa." }
)
// TextBlock array
TextResult(
ContentType = "text/plain",
SourceLanguage = "en",
AdaptedTo = new List<string> { "mem_1_id", "mem_2_id" },
Translation = new List<TextBlock> {
new TextBlock("Ciao, come stai?", true),
new TextBlock("Che giornata meravigliosa.", true)
}
)// Single string
TextResult(
contentType: "text/plain",
sourceLanguage: "en",
translation: TranslatedValue(translation: "Ciao, come stai?"),
adaptedTo: ["mem_1_id", "mem_2_id"]
)
// String array
TextResult(
contentType: "text/plain",
sourceLanguage: "en",
translation: TranslatedValue(translations: ["Ciao, come stai?", "Che giornata meravigliosa."]),
adaptedTo: ["mem_1_id", "mem_2_id"]
)
// TextBlock array
TextResult(
contentType: "text/plain",
sourceLanguage: "en",
translation: TranslatedValue(translationBlocks: [
TextBlock(text: "Ciao, come stai?", translatable: true),
TextBlock(text: "Che giornata meravigliosa.", translatable: true)
]),
adaptedTo: ["mem_1_id", "mem_2_id"]
)
XLIFF supportSupport for the
application/xliff+xmlcontent type is limited to text and a specific set of inline tags within the<source>element:XLIFF 1.2:
<g>,<x>,<ex>,<bx>,<ph>,<it>, and<mrk>.XLIFF 2.0:
<cp>,<ph>,<pc>,<sc>,<ec>,<sm>,<em>and<mrk>.For all other tags or advanced XLIFF features, please use the Document Translation service.
Lara Prosa
Lara Prosa is an advanced stylistic translation service for high-value content where voice, rhythm, and editorial quality matter as much as accuracy.
It builds on Lara’s core translation capabilities by combining glossaries, translation memories, and style guides to preserve meaning, terminology, consistency, and authorial or brand voice.
Rather than producing only fluent translations, Lara Prosa refines the text to maintain the distinctive nuances, personality, and expressive choices of the original. Alongside the translated output, it also provides structured editorial notes that explain key stylistic decisions.
Lara Prosa is designed for literary content, author-driven material, premium editorial workflows, and brand-sensitive communication where stylistic fidelity is essential.
Availability & Pricing
Lara Prosa is available on the plans below. Pricing is calculated per one million source characters.
| Plan | Standard | With reasoning |
|---|---|---|
| Free | Not Available | Not Available |
| Pro | € 200* | € 400* |
| Team | € 150* | € 300* |
*Pricing per 1M characters
To use Lara Prosa, simply pass the styleguideId parameter with the ID of the style guide you want to use. If you want higher quality, you can activate the styleguideReasoning:true parameter.
res = lara.translate('Hello, how are you?',
source='en-US',
target='it-IT',
styleguideId=123456,
styleguideReasoning=True
)
print(res.translation)const res = await lara.translate('Hello, how are you?', 'en-US', 'it-IT', {
styleguideReasoning: true,
styleguideId=123456
});TranslateOptions options = new TranslateOptions();
options.setStyle(TranslationStyle.FLUID);
options.setReasoning(true);
TextResult res = lara.translate("Hello, how are you?", "en-US", "it-IT", options);$options = new TranslateOptions([
'styleguideReasoning':true,
'styleguideId'=123456
]);
$res = $lara->translate('Hello, how are you?', 'en-US', 'it-IT', $options);res, _ := lara.Translate("Hello, how are you?", "en-US", "it-IT",
lara_sdk.TranslateOptions{
StyleguideReasoning: true,
StyleguideId: 123456
})
fmt.Println(*res.Translation.String)// Sdk available soonvar res = await lara.Translate(
"test example", "en-US", "it-IT",
new TranslateOptions {
styleguideReasoning = true,
styleguideId = 123456,
});// All options are optional and can be omitted
let options = TranslateOptions()
.setAdaptTo(["mem_1_id", "mem_2_id"])
.setStyleguideId(123456)
.setStyleguideReasoning(true)
let res = try await lara.translate(text: "Hello, how are you?", source: "en-US", target: "it-IT", options: options)
Create your style guideHere you can find all the information you need to create and manage your style guides
Lara Think
Lara Think is an advanced AI translation model that performs multi-step linguistic analysis across all available project assets, including glossaries, style guides, and contextual metadata.
This approach enables automatic detection and correction of approximately 80% of major linguistic issues, improving terminology consistency and stylistic accuracy compared to standard models.
Lara Think requires significantly more computation and can result in up to a 10× increase in processing time. It is best suited for workflows where translation quality and consistency are prioritized over latency.
Availability & Pricing
As a result of its higher computational cost, Lara Think is available on the plans below. Pricing is calculated per one million source characters.
| Plan | High Reasoning Effort | Medium Reasoning Effort | Low Reasoning Effort |
|---|---|---|---|
| Free | Not Available | Not Available | Not Available |
| Pro | €2,000 / 1M chars $2,499 / 1M chars | €500 / 1M chars $625 / 1M chars | €50 / 1M chars $62 / 1M chars |
| Team | €1,500 / 1M chars $1,999 / 1M chars | €400 / 1M chars $533 / 1M chars | €40 / 1M chars $53 / 1M chars |
Basic Reasoning Usage
To enable reasoning, simply pass the reasoning:true parameter within the options object. This method returns the final translation after the reasoning process is complete.
res = lara.translate('Hello, how are you?',
source='en-US',
target='it-IT',
style="fluid",
reasoning=True,
)
print(res.translation)const res = await lara.translate('Hello, how are you?', 'en-US', 'it-IT', {
reasoning: true,
style: 'fluid',
});TranslateOptions options = new TranslateOptions();
options.setStyle(TranslationStyle.FLUID);
options.setReasoning(true);
TextResult res = lara.translate("Hello, how are you?", "en-US", "it-IT", options);$options = new TranslateOptions([
'reasoning' => true,
'style' => 'fluid'
]);
$res = $lara->translate('Hello, how are you?', 'en-US', 'it-IT', $options);// Sdk available soon// Sdk available soonvar res = await lara.Translate(
"test example", "en-US", "it-IT",
new TranslateOptions {
Reasoning = true,
Style = TranslationStyle.Fluid,
});// All options are optional and can be omitted
let options = TranslateOptions()
.setAdaptTo(["mem_1_id", "mem_2_id"])
.setGlossaries(["gls_1_id", "gls_2_id"])
.setReasoning(true)
let res = try await lara.translate(text: "Hello, how are you?", source: "en-US", target: "it-IT", options: options)Handling Partial Results
If you want to receive the initial translation (Lara) and subsequently the refined version (Lara Think), you can implement a callback function.
The callback will be triggered as soon as the preliminary results are available, while the await will resolve with the final reasoned translation.
res = lara.translate('Hello, how are you?',
source='en-US',
target='it-IT',
style="fluid",
reasoning=True,
callback=lambda partial: print("translate reasoning partial:", result),
)
print(res.translation)const res = await lara.translate('Hello, how are you?', 'en-US', 'it-IT', {
reasoning:true,
style: 'fluid',
}, (partialResult) => console.log(partialResult)
);TranslateOptions options = new TranslateOptions();
options.setStyle(TranslationStyle.FLUID);
options.setReasoning(true);
Consumer<TextResult> onPartial = partial ->
System.out.println("translate reasoning partial" + ": " + partial.getTranslation());
TextResult res = lara.translate("Hello, how are you?", "en-US", "it-IT", options, onPartial);$lara->translate(
"Please summarize the following: Lara translates text.",
$source, $target,
new TranslateOptions([
'reasoning' => true,
'style' => 'fluid'
]),
function ($partial) {
print_r($partial);
}
);;// Sdk available soonval options = TranslateOptions().apply {
style = TranslationStyle.FLUID
reasoning = true
}
val onPartial: Consumer<TextResult> = Consumer { partial ->
println("translate reasoning partial: ${partial.translation}")
}
val res: TextResult = lara.translate("Hello, how are you?", "en-US", "it-IT", options, onPartial)var result = await lara.Translate<string>(
"Please summarize the following: Lara translates text.",
source, target,
new TranslateOptions
{
Reasoning = true,
Style = TranslationStyle.Fluid,
},
partial => Console.WriteLine(partial)
);// Sdk available soonProfanity Filter
The profanity filter option is designed to give you control over the handling of offensive language during the translation process. Instead of simply blocking content, the service allows you to automate the detection and transformation of profanity to ensure that the final result aligns with your safety standards or specific use cases. It bridges the gap between raw translation and content moderation, making it easier to maintain a professional tone in multiple languages.
Parameters
profanitiesDetect: Defines the "where" You can choose to analyze only the generated output (target) if you are only interested in the final result, or to check both the input and the output (source_target) for more comprehensive filtering.profanitiesHandling: Defines the "what" Determines whether the system should simply flag the terms (detect), mask them with placeholders (hide), or actively attempt to reformulate the translation to provide an appropriate alternative (avoid).
Do Not Translate (DNT tags)
To ensure maximum translation accuracy, Lara supports the exclusion of specific text segments. When the translation engine encounters a DNT tag, the content enclosed within it will be preserved in its entirety, without undergoing any translation, localization, or capitalization changes.
Web Standards (Recommended)
These tags are the standard for the web and ensure maximum compatibility with crawlers and localization systems:
- HTML5 attribute (W3C standard):
Use the attributetranslate="no"on any HTML tag.
Example:<p translate="no">BrandName</p>or<div translate="no">Confidential text</div> - Legacy CSS class:
Support for the .notranslate class.
Example:<span class="notranslate">text not to be translated</span>
Note: The attribute translate="no" and the class notranslate are recognized on every type of HTML element (e.g. <div>, <p>, <a>, etc.) and are not limited to the <span> tag only.
Custom Tag (XML/HTML)
For specific contexts or custom formats, you can use the dedicated custom tag:
- XML/HTML tag:
<notranslate>ProductCode123</notranslate>
Important notesLimitations of the Plain Text format: Please note that this feature is not available when the input content is sent as text/plain. To enable tag recognition, make sure the input format is correctly set to text/html.
Summary Table: It might be useful to add a summary table for developers who need a quick reference:
| Syntax | Type | Example |
|---|---|---|
translate="no" | W3C Standard | <span translate="no">...</span> |
class="notranslate" | Web Legacy | <div class="notranslate">...</div> |
<notranslate> | Custom | <notranslate>ID_001</notranslate> |
Updated 11 days ago
