Patch Changes
-
62dbc7e: Add optional locale-level concurrency to the translate flow.
translate()andwatch()now accept an optionalconcurrency(a positive integer, surfaced on the CLI as the--concurrency <n>flag ontranslateandwatch), running up to that many target locales at once through a bounded worker pool. The default is 1, which stays strictly serial and byte-identical to before: same written files, sameRunSummary.localesorder, same lock-file content. Regardless of completion order, results are always collected back into source-locale order. Because a token budget's stop guarantee is order-dependent, a live run that setsconcurrencygreater than 1 whilemaxTokensis configured is refused up front with aCONCURRENCY_BUDGET_CONFLICTerror (a dry run is exempt); an invalid value is rejected withCONCURRENCY_INVALID. No new locking is added: the per-locale write locks already isolate concurrent locales on disk. -
ca2d99a: Add a content-addressed translation-memory (TM) cache so a translation whose source content is unchanged is reused for free instead of being re-sent to the provider. A translation is reused even when its key was renamed, and identical source text shared across two keys is paid for once. The cache lives in a local, gitignored, regenerable
verbatra.cache.jsonsibling to the lock file (scaffolded into.gitignorebyinit); it is never a field on the lock file and never committed.Each entry is keyed by
(sourceContentHash, targetLocale, fingerprint), nested by fingerprint under a top-levelversion. The fingerprint is a stable hash over the provider id, model, tone, and sorted glossary; format is deliberately excluded because every reused value is re-checked by the placeholder/ICU integrity gate against the current source before it is applied, so a hit that no longer matches the target format is discarded and its key falls through to the provider. Reused hits apply silently (never flagged for review). A changed fingerprint (for example a different tone) never serves a stale value.The cache is resilient by design: a missing, corrupt, oversized, or unrecognized-version file degrades to an empty cache and never fails a run (unlike the fatal lock-file). It is read once as an immutable snapshot at run start and written once at the end (best-effort, dry-run-skipped), which keeps it safe under locale concurrency. Values accepted by
importWorkbook,editEntry, andretranslateEntryare also fed into the cache so a later run reuses them.The cache is on by default.
translate()andwatch()accept an optionalcacheinput (surfaced on the CLI as--no-cache) that bypasses both the read and the write for a run, making it behave exactly as if no cache existed and leaving any existing cache file untouched. To rebuild or discard the cache, deleteverbatra.cache.json; it is regenerated naturally on the next run.LocaleSummarygains acacheHitsbucket (rendered as "from cache" in the CLI) reporting the keys served from cache as avoided provider usage.Within a single run, byte-identical source text shared across two or more keys is translated once per target locale: the provider misses are deduplicated by source content hash, one representative is sent, and its accepted value is fanned out to every key that shares the content (and cached and lock-advanced identically). This holds even when the keys would otherwise fall into separate provider batches.
Known limitation: generated plural forms are out of v1 TM scope. A synthesized CLDR plural form is neither served from nor written to the cache; only main-path diff candidates participate.
-
Updated dependencies [a6767a6]
-
Updated dependencies [62dbc7e]
-
Updated dependencies [72bacc3]
-
Updated dependencies [b98d7f2]
-
Updated dependencies [ca2d99a]
- @verbatra/sdk@0.6.2