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:
npx replexica@latest auth
Core Command: i18n
The i18n
command is the heart of Replexica. It handles translation updates for your project.
Basic usage:
npx replexica@latest i18n
This command:
- Reads your source files;
- Identifies new or changed content;
- Translates this content;
- Updates your translation files;
- 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:
npx replexica@latest i18n --locale fr
Process only a specific bucket type (bucket type must be defined in your config):
npx replexica@latest i18n --bucket json
Check if translations are up-to-date, and fail if not (useful in CI/CD):
npx replexica@latest i18n --frozen
Retranslate everything (useful i.e. after changing AI context settings):
npx replexica@latest i18n --force
Retranslate everything in a specific bucket type:
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:
npx replexica@latest show config
Show Sources
List available source locales:
npx replexica@latest show locale sources
Show Targets
List available target locales:
npx replexica@latest show locale targets
Pro Tips
Always commit the
i18n.lock
file. It helps Replexica track translation changes.Use the
--frozen
flag in your CI pipeline to catch missing translations:bashnpx replexica@latest i18n --frozen
The
--force
flag is useful after changing your AI context settings:bashnpx replexica@latest i18n --force
Automation: Integrate Replexica into your build process for automatic translations and translation checks on every commit.
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.If you need to exclude certain files from translation, use the
exclude
array in youri18n.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.