DocsCLI

Lock file

What generic-translation.lock.json records, why you should commit it, and how to reset it.

On this page

generic-translation translate writes generic-translation.lock.json next to generic-translation.config.json. It lets later runs skip work that is already done: only messages that are new, or not yet translated into a newly added locale, are sent to the API.

Commit it. Without it every run has to ask the API about every message (the API still caches by hash, so nothing is translated twice, but the run is slower and noisier).

Shape

{
  "version": 1,
  "projectId": "prj_…",
  "entries": {
    "b1395fddbbacadda17814498697c69f1": {
      "source": "Hello, world!",
      "locales": ["es", "fr"]
    },
    "5e0c1f…": {
      "source": "Save",
      "context": "button label",
      "id": "actions.save",
      "locales": ["es"]
    }
  },
  "files": {
    "docs/en/guide.md": {
      "format": "md",
      "contentHash": "9c2f…",
      "fileId": "fil_…",
      "locales": ["es", "fr"]
    }
  }
}
  • entries is keyed by the message hash. locales lists the target locales for which a translation has been downloaded. source, context and id are recorded for readability.
  • files is keyed by source file path. contentHash is the first 32 hex characters of the SHA-256 of the file content; a changed file is uploaded again. fileId is the API’s file id.
  • Keys are sorted and the file ends with a newline, so diffs are stable.

How it is used

  • Messages whose hash is absent, or whose locales lack a configured target, are submitted. Everything else is counted as unchanged.
  • After each run, entries are rebuilt from the current extraction, so messages you removed from source disappear from the lock. Locales that were not part of the run keep their previous status.
  • A file is skipped when its content hash, format and locales match and every output file still exists. If outputs were deleted, they are downloaded again from the existing upload.
  • If the server turns out to be missing strings the lock believed done (a new branch, a wiped project), the CLI submits those in a second round.

Resetting

The lock is ignored when it is unreadable, from another version, or belongs to a different projectId. To force a full re-run use generic-translation translate --force, or delete the file.

Something wrong or unclear on this page? Open an issue.

Type to search the documentation.