Skip to content

CLI

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

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

Getting Started

Authentication

Before using Replexica, make sure you're authenticated:

bash
npx replexica@latest auth

Core Command: i18n

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

Basic usage:

bash
npx replexica@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 replexica@latest i18n --locale fr

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

bash
npx replexica@latest i18n --bucket json

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

bash
npx replexica@latest i18n --frozen

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

bash
npx replexica@latest i18n --force

Retranslate everything in a specific bucket type:

bash
npx replexica@latest i18n --force --bucket json

Configuration Commands

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

Show Config

Display your current Replexica configuration:

bash
npx replexica@latest show config

Show Sources

List available source locales:

bash
npx replexica@latest show locale sources

Show Targets

List available target locales:

bash
npx replexica@latest show locale targets

Pro Tips

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

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

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

    bash
    npx replexica@latest i18n --force
  4. Automation: Integrate Replexica 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 Replexica 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.