transglot
v0.2.0
Published
CI client for transglot: push/pull translation files, wait on AI batches.
Maintainers
Readme
transglot
The CI client for transglot: push source strings, pull localized files, and wait on AI translation batches from a pipeline or a local checkout.
Install
npm install --save-dev transglot
# or run once, no install:
npx transglot --helpUsage
transglot init # scaffold a transglot.json in the repo
transglot push # upload source strings
transglot pull # download localized files
transglot status # report a project / batch state
transglot cancel 12 # stop a running AI batchConfiguration lives in transglot.json (the server url, the sources and
pull file globs, and their formats). Authentication uses a deploy token in the
TRANSGLOT_TOKEN environment variable.
pull will not empty a file for you
If the server reports zero entries for a locale, pull refuses to write over an
existing non-empty file and exits 1. That happens for ordinary reasons: the
locale has not been translated yet, min_state: reviewed matches nothing so far,
or a push is still running (it returns as soon as the batch is queued, so use
transglot push --wait && transglot pull rather than the bare pair).
Writing to a path that does not exist yet is unaffected, so a first pull still
scaffolds. If you really are clearing a locale, pass --allow-empty.
Run transglot <command> --help for the flags of each command.
File formats
Every rule in sources and pull carries a format. transglot init offers
these as a numbered menu and proposes a matching {locale} path template.
| Format | Default extension |
| --- | --- |
| json_flat | .json |
| json_nested | .json |
| android_xml | .xml |
| ios_strings | .strings |
| ios_stringsdict | .stringsdict |
| flutter_arb | .arb |
| laravel_php | .php |
| laravel_json | .json |
| xliff_12 | .xlf |
| ios_xcstrings | .xcstrings |
| gettext_po | .po |
| yaml | .yml |
| csv | .csv |
| xlsx | .xlsx |
| xliff_20 | .xlf |
| java_properties | .properties |
| resx | .resx |
| markdown | .md |
| unity_csv | .csv |
| unreal_po | .po |
unity_csv and unreal_po are the game engine formats (Unity string tables and
Unreal .po catalogs).
This table is pinned by tests/format-parity.test.ts, which reads the server's
app/Enums/FileFormat.php and fails if the CLI, the table, and the server enum
ever disagree.
