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.

  1. Visit Lara Translate and subscribe to any plan (including the free one).
  2. Go to the API section in your account dashboard and generate a new pair of credentials.
  3. 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

FormatExtensionDescriptionDocumentation
JSON.jsonNested or flat JSON structures commonly used in JavaScript/TypeScript applicationsBuilt-in support
PO.poGettext Portable Object files commonly used in PHP, Python, and other platformsPO Files Guide
TS.tsTypeScript files commonly used in Vue.js applicationsTS Files Guide
Vue.vueVue I18n single-file componentsVue Files Guide
Markdown/MDX.md, .mdxMarkdown and MDX files for documentation, blogs, and content sitesMarkdown Files Guide
Android XML.xmlAndroid string resource files commonly used in Android applicationsAndroid XML Files Guide

How It Works

The file format is automatically detected based on the file extension:

  • Files ending with .json are parsed as JSON
  • Files ending with .po are parsed as PO (gettext) files
  • Files ending with .ts are parsed as TypeScript files
  • Files ending with .vue are parsed as Vue.js I18n single-file components
  • Files ending with .md or .mdx are parsed as Markdown/MDX files
  • Files ending with .xml are 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

Commands

Format-Specific Guides