Language Bridge

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 Resources interface that augments i18next's CustomTypeOptions, so t('ns:key') is autocompleted and unknown keys are compile errors.
  • Interpolation params — a TranslationParams map (parsed from the value placeholders) plus a createTypedT wrapper, so t('key', { … }) params are typed. This is beyond what i18next can infer from strings.

Install

npm i -D @language-bridge/cli

Quick 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-app

CI

Skip lb login and pass LB_TOKEN (a lb_pat_… PAT or project API token). See Configuration.

Commands

CommandWhat
initScaffold a language-bridge.json config.
loginAuthorize this machine and store a token.
logoutRemove the stored token for a server.
whoamiShow the user + projects a token can reach.
syncPull + generate types (default command).
pullFetch translations to raw JSON.
generateGenerate the .d.ts from pulled JSON.
pushPush local JSON as reviewable proposals.
addAdd/update one key and push it — no local files.
reviewOpen the review page in your browser.
checkCI guard against shipping unpublished keys.
ai-instructionsPrint AI-agent rules for a project.
validate-configValidate the local config end-to-end.
completionPrint a shell completion script.

Then wire the generated types into i18next — see Typed i18next.

License

MIT

On this page