Commands
Core Commands
The Lara CLI provides several commands to handle different translation scenarios and manage your translation resources.
translate
translateUse the translate command to perform translations between Supported Languages pairs. This command supports both text and file-based translations with advanced options to refine output quality.
Supported options:
--text(string): The text content to translate.--source(optional string): ISO code of the source language (e.g.,"fr-FR"). If omitted, automatic language detection will be used.--target(string): ISO code of the target language (e.g.,"en-US").--context(optional string): Contextual information to guide translation (e.g., domain, tone, situation).--instructions(optional string array): One or more translation instructions (e.g.,"Use formal tone","Avoid slang").--memory(optional string): ID of translation memory to use for consistent terminology.--glossary(optional string): ID of glossary to apply for domain-specific terms.--file(optional string): Path to file for translation instead of direct text input.
Example:
lara translate --text "Hello, world!" --source en-US --target fr-FRResponse:
Bonjour, le monde !
Example with context:
lara translate --text "la terra è rossa" --target en-US --context "Conversation with a tennis player"Response:
The clay is red.
Translation Memory Commands
The Lara CLI provides commands to list, create, and manage translation memories, which are essential for maintaining consistency and improving translation quality across projects.
memory list
memory listLists all translation memories linked to your account with their details.
Example:
lara memory listResponse:
[
{
"id": "mem_XYZ",
"name": "Product Documentation",
"ownerId": "acc_XYZ",
"collaboratorsCount": 3,
"createdAt": "2025-01-15T10:24:19.867Z",
"updatedAt": "2025-01-20T15:30:42.881Z"
}
]memory create
memory createCreates a new translation memory and links it to your account.
Supported options:
--name(string): Name of the new memory.--external-id(optional string): ID of the memory to import from MyMemory (e.g., 'ext_my_[MyMemory ID]').
Example:
lara memory create --name "Marketing Content"Response:
{
"id": "mem_ABC123",
"name": "Marketing Content",
"ownerId": "acc_XYZ",
"createdAt": "2025-01-26T14:22:10.123Z"
}memory update
memory updateUpdates an existing translation memory name.
Supported options:
--id(string): ID of the memory to update.--name(string): The new name for the memory.
Example:
lara memory update --id mem_ABC123 --name "Marketing & Sales Content"memory delete
memory deleteDeletes a translation memory from your account.
Supported options:
--id(string): ID of the memory to delete.
Example:
lara memory delete --id mem_ABC123memory add-translation
memory add-translationAdds a translation unit to an existing memory.
Supported options:
--id(string): ID of the memory where to add the translation unit.--source(string): Source language code.--target(string): Target language code.--sentence(string): The source sentence.--translation(string): The translated sentence.--tuid(optional string): Translation Unit unique identifier.
Example:
lara memory add-translation --id mem_ABC123 --source en-US --target es-ES --sentence "Welcome" --translation "Bienvenido"memory import-tmx
memory import-tmxImports a TMX file into a translation memory.
Supported options:
--id(string): ID of the memory to update.--file(string): The path of the TMX file to upload.--gzip(optional boolean): Indicates if the file is compressed (.gz).
Example:
lara memory import-tmx --id mem_ABC123 --file ./translations.tmxResponse:
{
"id": "job_DEF456",
"size": 1250,
"progress": 0
}memory check-import
memory check-importChecks the status of a TMX file import job.
Supported options:
--job-id(string): The ID of the import job.
Example:
lara memory check-import --job-id job_DEF456Response:
{
"id": "job_DEF456",
"size": 1250,
"progress": 1
}Translation Workflow
The CLI's primary function is the translate command, which accepts text or file input along with language specifications and optional parameters for context and instructions.
For instance, if you're translating technical documentation and need a formal tone, you can specify this in the command. The CLI will ensure that the translation maintains the appropriate register and terminology consistency throughout.
Batch Processing Example
Command:
lara translate --file ./docs/readme.md --source en-US --target de-DE --context "Technical documentation" --instructions "Use formal tone" --memory mem_ABC123This command translates an entire markdown file while maintaining technical terminology from your translation memory and applying formal language style.
Glossary Command
The glossary command lists all Glossaries available in your Lara account. Glossaries ensure consistent and accurate translations for domain-specific terminology.
Usage
lara-cli glossary [options]Options
| Option | Description |
|---|---|
-h, --help | Display help information |
Example Output
ℹ Found 3 Glossaries:
ID: gls_abc123def456
Name: Legal Terminology EN-ES
ID: gls_xyz789uvw012
Name: Medical Terms Database
ID: gls_mno345pqr678
Name: Product Names & BrandsPrerequisites
Before using the glossary command:
-
Set up your Lara API credentials in a
.envfile:LARA_ACCESS_KEY_ID=your_access_key_id LARA_ACCESS_KEY_SECRET=your_access_key_secret -
Have at least one Glossary created in your Lara account
Using Glossaries
After identifying available Glossaries, you can:
-
During initialization: Add glossaries when running
lara-cli initlara-cli init # You'll be prompted to select Glossaries -
Non-interactive initialization: Specify glossaries directly
lara-cli init --glossaries "gls_abc123, gls_def456" --non-interactive -
Manual configuration: Add to your
lara.yamlfileglossaries: - gls_abc123 - gls_def456
For detailed documentation on using Lara Cli:
Commands
- Init Command - Initialize your project
- Translate Command - Translate your files
- Memory Command - List available Translation Memories
- Glossary Command - List available Glossaries
Updated 1 day ago
