Skip to content

CLI

Lingo.dev CLI is your command-line interface to manipulate translations in your team projects.

Lingo.dev CLI connects your project to Lingo.dev's AI translation engine, making localization fast, straightforward, and efficient.

Getting Started

Authentication

Before using Lingo.dev, make sure you're authenticated:

bash
npx lingo.dev@latest auth

Core Command: i18n

The i18n command is the heart of Lingo.dev. It handles translation updates for your project.

Basic usage:

bash
npx lingo.dev@latest i18n

This command:

  1. Reads your source files;
  2. Identifies new or changed content;
  3. Translates this content;
  4. Updates your translation files;
  5. Updates the i18n.lock file, if needed.

Options

  • --locale <locale>: Translate to a specific locale;
  • --bucket <bucket-type>: Process a specific bucket type;
  • --frozen: Don't update translations, fail if updates are needed;
  • --force: Ignore lockfile and retranslate everything.

Examples

Translate only to French:

bash
npx lingo.dev@latest i18n --locale fr

Process only a specific bucket type (bucket type must be defined in your config):

bash
npx lingo.dev@latest i18n --bucket json

Check if translations are up-to-date, and fail if not (useful in CI/CD):

bash
npx lingo.dev@latest i18n --frozen

Retranslate everything (useful i.e. after changing AI context settings):

bash
npx lingo.dev@latest i18n --force

Retranslate everything in a specific bucket type:

bash
npx lingo.dev@latest i18n --force --bucket json

Configuration Commands

Lingo.dev has a few commands to make it easier to manage your project's configuration.

Show Config

Display your current Lingo.dev configuration:

bash
npx lingo.dev@latest show config

Show Sources

List available source locales:

bash
npx lingo.dev@latest show locale sources

Show Targets

List available target locales:

bash
npx lingo.dev@latest show locale targets

Pro Tips

  1. Always commit the i18n.lock file. It helps Lingo.dev track translation changes.

  2. Use the --frozen flag in your CI pipeline to catch missing translations:

    bash
    npx lingo.dev@latest i18n --frozen
  3. The --force flag is useful after changing your AI context settings:

    bash
    npx lingo.dev@latest i18n --force
  4. Automation: Integrate Lingo.dev into your build process for automatic translations and translation checks on every commit.

  5. When using the --bucket flag, remember it now refers to the entire bucket type (e.g., 'json', 'markdown') rather than a specific file pattern. This allows you to process all files of a certain type at once.

  6. If you need to exclude certain files from translation, use the exclude array in your i18n.json configuration file rather than trying to do it via the CLI.

With these commands and tips, you're well-equipped to manage your project's translations efficiently using Lingo.dev CLI. The new bucket configuration allows for more flexible and powerful file management, enabling you to easily include or exclude files based on your project's needs.