lingui-translate: AI CLI for Lingui PO translations
lingui-translate is an AI CLI for filling missing Lingui PO translations. I wrote it to turn a repetitive localization task into something that fits cleanly into build pipelines, CI jobs, and normal developer workflows.
The package is available on npm and the source lives on GitHub. It focuses on one job: detect missing translations, ask a configured model for the gaps, and write the results back into the existing PO files.
I wrote
lingui-translate
(npm),
a small CLI that fills missing Lingui messages.po
translations with an LLM.
The problem is boring, but it keeps showing up: you add or change UI copy, run extraction, and now every locale has empty PO entries. Humans forget to fill them. AI agents also forget surprisingly often, and when they do remember, the output is not always consistent across files or projects.
That should be automated. Especially now. If an LLM is already good enough to translate product strings, the useful part is not asking it manually. The useful part is making translation a normal build step.
How it works
lingui-translate scans a Lingui locales directory, reads
the existing PO files, finds missing translations, asks the configured
model for only those entries, and writes the result back into the same
files.
For each missing translation it also looks at the 10 physically closest existing translations in the PO file. That gives the model nearby wording, tone, and terminology instead of translating each string in isolation.
npm install --save-dev lingui-translate
npx lingui-translate --locales-dir src/locales --languages de es
There is also a dry run mode, config file support, worker concurrency, custom models, custom prompts, and environment variables for API keys and base URLs. The defaults are meant to be useful, but not magical.
Why a package
I have the same need in multiple packages. Copying a script around is fine once. After that it becomes another thing to maintain, forget, or slightly fork. Publishing it as an npm package makes it easy to put in a build pipeline, CI job, or pre-commit hook.
The exit code is set up for automation too: success if nothing changed, a separate code when translations were written, and a normal failure code for CLI errors. That makes it easier to decide whether a pipeline should pass, fail, or commit generated translation changes.
This is not trying to be a localization platform. It just removes one repetitive step from Lingui projects. That is enough.