CLI
@radicalstorage-lingo/cli pulls and pushes translations as JSON at build
time. It authenticates with a project API key (LINGO_API_KEY env, or stored
by lingo login).
lingo.config.json
{
"projectId": "prj_xxxxx",
"apiUrl": "http://localhost:3000",
"languages": [],
"format": "json-nested",
"outDir": "messages",
"typesOut": ".lingo/types.ts",
"pull": "translated"
}
-
apiUrl— the address of your Lingo instance, for examplehttps://<your-lingo-host>. The default ishttp://localhost:3000. -
projectId— the project's id or its slug (the slug is what the app's URLs show, e.g.app/acme/customer-app→ slugcustomer-app). Either works everywhere the CLI or the v1 API takes a project id. Leave it blank in a fresh config andlingo loginwill fill in the id automatically, as long as the key can only see one project. -
languages— which languagespull/push/status/diffoperate on. An empty array (the default fromlingo init) or omitting the key entirely means every language in the project — the source language plus all its configured targets, fetched from the project API at run time. An explicit, non-empty list (e.g.["de-DE"]) always wins and restricts every command to just those languages. -
format—json-nested(default) orjson-flat. -
pull— which valueslingo pullwrites into the bundle:translated(default) — every value with real text, regardless of status (draft/in_review/approved). Machine translation (DeepL) writes draft copy immediately as "fuzzy" text that's safe to ship right away; review un-flags it asynchronously — it is not a publish gate. This is what most apps want.approved— only values that have cleared review, for teams that want review-gated builds.all— deprecated alias fortranslated, kept so existing configs keep working.
In every mode, untranslated (
missing, empty) values are never written — a blank string in a bundle silently masks the SDK's fallback behavior at runtime, so a key is either pulled with real text or omitted entirely. -
split(CLI 0.4.0+) — file layout:none(default) —{outDir}/{lang}.json, every key under its full path (common.title).namespace—{outDir}/{lang}/{namespace}.json, one file per top-level namespace with keys relative to it (title),_root.jsonfor keys without a namespace. The layout of next-i18next'spublic/localesand i18next namespace loading, and the same content the API returns when a server loads translations at runtime. Every namespace gets a file in every language,{}when nothing is translated yet.status/diff/pushread the folders back.
-
languageMap(CLI 0.4.0+) — names for the language files or folders instead of Lingo's codes, e.g.{ "zh-CN": "zh_cn", "ko-KR": "ko_kr", "pt-PT": "pt" }. Languages not listed keep their Lingo code.
Commands
| Command | What it does |
|---|---|
lingo init [--project <id-or-slug>] [--api-url <url>] [--out <dir>] [-y, --yes] | Create lingo.config.json. Interactive wizard by default; --yes (or a non-TTY/CI shell) writes from flags + defaults with no prompts. |
lingo login --api-key <key> | Store the key in ~/.lingo/credentials.json. If the config's projectId is blank, fills it in from the key's own project. |
lingo pull [--out <dir>] | Download translations → messages/{lang}.json (or {lang}/{namespace}.json with split: "namespace") + generate .lingo/types.ts. --out overrides outDir from the config for that run. |
lingo push [--yes] | Upload changed local values to existing keys (preview unless --yes). |
lingo status | Summarize local vs remote drift per language. |
lingo diff | Per-key drift (added / changed / removed). |
lingo init wizard
Run on a real terminal (TTY) without --yes, lingo init walks through:
- API URL — defaults to
http://localhost:3000(or--api-urlif passed). - API key — offers your saved key (
LINGO_API_KEYor~/.lingo/credentials.json) if one exists, otherwise prompts for one (Enter to skip). When a key is available, the project is derived from it automatically; a freshly entered key is saved for next time. If fetching the project fails, the wizard falls back to asking for a project id/slug manually rather than failing the whole command. - Output directory — defaults to
messages(or--outif passed). - Bundle format —
json-nestedorjson-flat. - Pull mode —
translated(incl. drafts, recommended) orapprovedonly. - Languages — "all project languages" (default) or an explicit comma-separated list.
Ctrl-C / Esc at any step aborts with no file written. If lingo.config.json already
exists, the wizard asks before overwriting it; declining leaves the existing file
untouched.
lingo init --yes (or any invocation where stdin isn't a TTY — CI, piped input, etc.)
skips the wizard entirely and writes the config straight from --project / --api-url
/ --out plus defaults, identical to the CLI's previous non-interactive behavior.
Auth
lingo login --api-key lgo_live_xxxxx # interactive / local
LINGO_API_KEY=lgo_live_xxxxx lingo pull # CI
A key with read:translations is enough for pull, status and diff, and
for login to find its project. push also needs write:translations; keep
that key out of builds.
Notes
pushonly updates values for keys that already exist remotely; create new keys in the app first (it warns and skips unknown keys).pushchanges the text and keeps each value's status. An approved value stays approved with the pushed text, and an empty value that gets text becomes a draft.statusis read-only and safe as a CI guard.pull's per-language line reports how many keys were written, and how many were skipped as untranslated:✓ messages/de-DE.json (128 keys, 12 untranslated skipped). Withsplit: "namespace"it names the folder and counts the files:✓ public/locales/de/ — 5 namespace files, 128 keys.- When
languagesresolves to "all" (empty/omitted), every command prints which languages it resolved to before doing anything, e.g.→ pulling all project languages: en-US, de-DE, fr-FR. - The published binary is a self-contained bundle (no
postinstall, no native deps).