Watch Mode: Automatic Retranslation on File Changes
Lingo.dev CLI now supports a powerful watch mode for the run
command, enabling automatic retranslation whenever your source files change.
How it works
When you run the CLI with the --watch
flag, it continuously monitors your configured source files (as defined in your i18n.json
buckets) for changes. When a file is added, modified, or deleted, the CLI automatically triggers the translation workflow, updating your target locale files and the i18n.lock
as needed.
This is ideal for rapid development, live preview environments, or any workflow where you want translations to stay in sync with your source content in real time.
Usage
npx lingo.dev@latest run --watch
- The CLI will start in watch mode, displaying logs for detected changes and translation progress.
- By default, changes are debounced for 5 seconds to avoid redundant runs during rapid edits.
- The process will continue running until you stop it (Ctrl+C).
Debounce Option
You can customize the debounce delay (in milliseconds) using the --debounce
flag:
npx lingo.dev@latest run --watch --debounce 10000
This example sets a 10-second debounce window between detected changes and the next translation run.
Features
- Automatic retranslation: Instantly updates translations as you edit your source files.
- Debounced runs: Prevents excessive translation requests during rapid file changes.
- Error handling: Watch mode gracefully handles errors and continues monitoring after failures.
- All file types: Works with any file types supported by your
i18n.json
configuration.
When to use watch mode
- During active development of multilingual features
- When previewing translation changes live in your app
- For continuous integration with local or cloud-based dev environments
Tip: Watch mode is designed for development and rapid iteration. For production or CI/CD, use the standard run
command without --watch
for one-off translation runs.