verbatra watch
Re-translate on every source change until interrupted.
Watch the source locale file and re-run a translation on each debounced change, until you interrupt it. watch runs an initial translation at startup, then keeps your target locales current as you save. Before it runs, it loads .env.local and then .env from the working directory; a variable already set in the real environment wins.
Synopsis
verbatra watch [flags]Flags
| Flag | Argument | Default | Effect |
|---|---|---|---|
--cwd | <path> | current directory | resolve config and locale files from this directory |
--config | <path> | search for one | load this config file instead of searching for one |
--debounce | <ms> | 300 | wait this many milliseconds after the last change before translating; must be a bare positive integer (a value like 250ms, 0, or -1 is a usage error, exit 2) |
--concurrency | <n> | 1 | translate up to n target locales at once per run; must be a positive integer |
--no-cache | none | off (cache on) | bypass the local translation-memory cache (verbatra.cache.json) on every run |
--json | none | off | print each run as one NDJSON record (one JSON object per line) on stdout |
With --json, each run emits one WatchRunResult record: a success carrying the run summary, or a failure carrying an error code and message. The startup line, the stopping notice, and per-run progress all go to stderr, so the stdout stream stays clean NDJSON. A failed run is just a record on the stream: it neither stops the watcher nor changes the exit code.
--concurrency applies to each cycle's run. Because each run's token budget is fresh, a --concurrency above 1 still fails every run with exit 2 when the config sets a maxTokens budget. --no-cache bypasses the translation-memory cache on every cycle.
Stopping
The first interrupt (Ctrl-C, or SIGTERM) lets the current run finish, stops the watcher cleanly, and exits 0. A second interrupt while that shutdown is still in flight force-stops with exit 130.
Examples
# watch and re-translate on each change
verbatra watch
# calmer in a busy editor: wait 1s after the last change, stream NDJSON
verbatra watch --debounce 1000 --jsonExit codes
| Code | Meaning |
|---|---|
0 | stopped cleanly by a single interrupt |
2 | could not start or stop: a config error, a startup or shutdown failure, or a usage error (including an invalid --debounce) |
130 | force-stopped by a second interrupt |
Related
verbatra translateis the one-shot runwatchrepeats.- The cache explains what
--no-cachebypasses on each run. - How it works explains what each run does.
- The SDK reference documents the
WatchRunResultandRunSummaryshapes.