Skip to main content
The translate command is the main workflow command. It pushes your source file, computes a diff, triggers AI translation for changed keys, and downloads the results.

Usage

npx lazylocales translate [options]

Options

FlagDescription
--locale <locales...>Only translate specific locales
--dry-runShow changes without calling the API
--jsonOutput machine-readable JSON

What it does

1

Check authentication

Verifies you’re logged in. If not, triggers the login flow automatically.
2

Load configuration

Reads lazylocales.config.ts from your project root. If no config exists, runs the interactive setup flow (project creation or linking).
3

Push source file

Reads the source locale file (e.g. en.json) and uploads it to LazyLocales. A diff is computed against the previous version:
+ 3 new keys
~ 1 modified key
- 0 deleted keys
Only changed keys are sent for translation.
4

Trigger translation

Starts translation jobs for each target locale. If --locale is specified, only those locales are translated.
5

Poll for progress

Displays live progress bars while translations are running:
nl-NL (Dutch)   ████████████████████ 142/142 ✓ done
fr-FR (French)  ████████████████████ 142/142 ✓ done
de (German)     ████████████████████ 142/142 ✓ done
6

Download locale files

Writes the translated JSON files to your localesDir:
┌─────────┬────────────────────────────┬────────┬────────┐
│ Locale  │ File                       │ Keys   │ Time   │
├─────────┼────────────────────────────┼────────┼────────┤
│ nl-NL   │ public/locales/nl-NL.json  │ 142    │ 18s    │
│ fr-FR   │ public/locales/fr-FR.json  │ 142    │ 22s    │
│ de      │ public/locales/de.json     │ 142    │ 16s    │
└─────────┴────────────────────────────┴────────┴────────┘

Examples

Translate all configured locales:
npx lazylocales translate
Translate only Dutch and French:
npx lazylocales translate --locale nl-NL fr-FR
Preview changes without translating:
npx lazylocales translate --dry-run
Output as JSON (for scripting):
npx lazylocales translate --json