Introduction to Lara CLI
What It Does
The Lara CLI brings powerful translation capabilities directly to your command line and development workflows. By providing a streamlined interface to Lara's translation engine, it enables developers to integrate accurate, context-aware, and culturally nuanced translations into their projects with minimal configuration.
The CLI acts as a direct bridge between your development environment and Lara's Translation Language Models. It allows you to perform professional-grade translations without leaving your terminal, making it ideal for automating translation tasks, integrating with CI/CD pipelines, or quickly translating content during development.
The tool supports features such as automatic source language detection, context injection, and custom instructions to guide translation behavior. These capabilities make it possible to tailor translation output to match the tone, style, or intent of your content—whether it's technical documentation, user-facing text, or creative writing.
API Credentials
To use the Lara CLI, you must have valid API credentials.
- Visit Lara Translate and subscribe to any plan (including the free one).
- Go to the API section in your account dashboard and generate a new pair of credentials.
- Store your credentials securely. If lost, you will need to generate a new pair.
Supported File Formats
Lara Cli supports multiple internationalization file formats. The appropriate parser is automatically selected based on the file extension.
Available Formats
| Format | Extension | Description | Documentation |
|---|---|---|---|
| JSON | .json | Nested or flat JSON structures commonly used in JavaScript/TypeScript applications | Built-in support |
| PO | .po | Gettext Portable Object files commonly used in PHP, Python, and other platforms | PO Files Guide |
| TS | .ts | TypeScript files commonly used in Vue.js applications | TS Files Guide |
| Vue | .vue | Vue I18n single-file components | Vue Files Guide |
| Markdown/MDX | .md, .mdx | Markdown and MDX files for documentation, blogs, and content sites | Markdown Files Guide |
| Android XML | .xml | Android string resource files commonly used in Android applications | Android XML Files Guide |
How It Works
The file format is automatically detected based on the file extension:
- Files ending with
.jsonare parsed as JSON - Files ending with
.poare parsed as PO (gettext) files - Files ending with
.tsare parsed as TypeScript files - Files ending with
.vueare parsed as Vue.js I18n single-file components - Files ending with
.mdor.mdxare parsed as Markdown/MDX files - Files ending with
.xmlare parsed as Android XML string resource files
You can configure multiple formats simultaneously in the same project by adding different format sections under the files configuration.
Configuration Example
files:
json:
include:
- 'src/i18n/[locale].json'
po:
include:
- 'locales/[locale]/LC_MESSAGES/messages.po'
ts:
include:
- 'src/i18n.ts'
md:
include:
- 'docs/[locale]/*.md'
xml:
include:
- 'res/[locale]/strings.xml'Technology Stack
Lara Cli is built with modern technologies to ensure reliability, performance, and maintainability:
- TypeScript - For type safety and developer experience
- Commander.js - For CLI argument parsing and command structure
- Zod - For robust schema validation
- Inquirer.js - For interactive command-line user interfaces
- Lara Translation API - For high-quality, context-aware translations
The codebase follows a modular architecture with clear separation of concerns, making it easy to extend and maintain.
Supported Locales
Lara Cli supports translations using different locale codes, following two main standards:
See the full list of supported locales.
Documentation
For detailed documentation on using Lara Cli:
Configuration
- Configuration Overview - Configuration system overview
- Supported Formats - Supported file formats (JSON, PO, etc.)
- Locales Configuration - Configure source and target languages
- Files Configuration - Configure file paths and patterns
- Instructions - Configure translation instructions
- Translation Memories - Configure Translation Memories
- Glossaries - Configure Glossaries
Commands
- Init Command - Initialize your project
- Translate Command - Translate your files
- Memory Command - List available Translation Memories
- Glossary Command - List available Glossaries
Format-Specific Guides
- PO Files Guide - Complete guide for gettext PO files
Updated 1 day ago
