Introduction
Pull translations from a server and generate typed i18next resources.
@language-bridge/cli pulls translations from a Language Bridge server
and generates typed i18next resources — fetching translations and emitting typed
i18next resources in one first-party tool.
Two layers of typing:
- Keys — a
Resourcesinterface that augments i18next'sCustomTypeOptions, sot('ns:key')is autocompleted and unknown keys are compile errors. - Interpolation params — a
TranslationParamsmap (parsed from the value placeholders) plus acreateTypedTwrapper, sot('key', { … })params are typed. This is beyond what i18next can infer from strings.
Install
npm i -D @language-bridge/cliQuick start
# authorize this machine in your browser once (stores a token)
lb login --url https://lb.example.com
# pull the source locale + generate types in one step (default command)
lb sync --project my-appCI
Skip lb login and pass LB_TOKEN (a lb_pat_… PAT or project API token).
See Configuration.
Commands
| Command | What |
|---|---|
init | Scaffold a language-bridge.json config. |
login | Authorize this machine and store a token. |
logout | Remove the stored token for a server. |
whoami | Show the user + projects a token can reach. |
sync | Pull + generate types (default command). |
pull | Fetch translations to raw JSON. |
generate | Generate the .d.ts from pulled JSON. |
push | Push local JSON as reviewable proposals. |
add | Add/update one key and push it — no local files. |
review | Open the review page in your browser. |
check | CI guard against shipping unpublished keys. |
ai-instructions | Print AI-agent rules for a project. |
validate-config | Validate the local config end-to-end. |
completion | Print a shell completion script. |
Then wire the generated types into i18next — see Typed i18next.
License
MIT