Parallel Processing
Lingo.dev CLI provides parallel processing through the run
command, which processes multiple localization tasks simultaneously to dramatically reduce translation time for large projects.
The run
command will gradually replace the i18n
command in future versions, providing the same functionality with significant performance improvements through concurrent processing.
Basic Usage
Process all translations with parallel processing:
npx lingo.dev@latest run
Control concurrency level:
npx lingo.dev@latest run --concurrency 20
The run
command uses the same i18n.json
configuration and i18n.lock
files as the standard i18n
command.
How Parallel Processing Works
Lingo.dev CLI distributes localization tasks across multiple concurrent workers, processing different language pairs and file patterns simultaneously.
Architecture overview:
- Task creation — CLI analyzes your configuration and creates individual tasks for each locale/file combination
- Worker distribution — Tasks are distributed across multiple worker processes
- Concurrent processing — Workers process translations simultaneously while preventing file conflicts
- Result aggregation — Completed translations are safely written to target files
Concurrency Control
Set worker count:
npx lingo.dev@latest run --concurrency 15
Default concurrency is 10 workers. Higher values process translations faster but consume more system resources and may hit API rate limits.
Optimal concurrency depends on your system capabilities and translation provider limits. Start with the default and adjust based on performance.
Targeted Processing
Process specific languages:
npx lingo.dev@latest run --locale es --locale fr
Process specific file types:
npx lingo.dev@latest run --bucket json
Process specific files:
npx lingo.dev@latest run --file components/header
Process specific keys:
npx lingo.dev@latest run --key welcome.title
Force retranslation:
npx lingo.dev@latest run --force
These targeting options work identically to the i18n
command but process tasks in parallel.
Race Condition Prevention
Lingo.dev CLI prevents file corruption during parallel processing through multiple safeguards:
I/O synchronization — File system operations are synchronized to prevent multiple workers from writing to the same file simultaneously.
Lockfile protection — The i18n.lock
file uses atomic operations to prevent corruption during concurrent updates.
Transactional processing — Each task completes fully or fails cleanly, ensuring consistent file states.
Performance Optimization
Monitor system resources when using high concurrency values. The CLI is designed for efficiency, but very large projects may benefit from resource monitoring.
Start with defaults:
npx lingo.dev@latest run
# Uses optimized concurrency settings
Scale up gradually:
npx lingo.dev@latest run --concurrency 20
# Increase if system handles load well
Target specific content for iteration:
npx lingo.dev@latest run --file src/components
# Process only changed components
Compatibility
The run
command maintains full compatibility with existing configurations:
- Same
i18n.json
format — No configuration changes required - Same
i18n.lock
behavior — Incremental translation tracking works identically - Same file formats — All bucket types supported
- Same targeting options —
--locale
,--bucket
,--key
,--file
,--force
flags work identically
Migration from i18n
command:
# Current command
npx lingo.dev@latest i18n
# Parallel equivalent
npx lingo.dev@latest run
All functionality transfers directly with significantly improved performance.
Worker Pool Architecture
Lingo.dev CLI uses a sophisticated worker pool system:
Dynamic allocation — Workers are created based on system resources and concurrency settings.
Task distribution — Tasks are evenly distributed across workers using optimized algorithms.
Progress tracking — Real-time progress monitoring across all parallel operations.
Resource management — Automatic cleanup and resource deallocation when processing completes.