- npm@localheroai/cli
- githublocalheroai/cli
- licenseMIT
Find broken translations before your users do
One command checks the translation files in your repo. No signup, no API key. Nothing leaves your machine.
npx @localheroai/cli check
A free command in the Localhero.ai CLI. Runs locally or as a GitHub Actions check.
Rails YAML · i18next and other JSON · gettext .po
$ npx @localheroai/cli check Locale Keys Missing Placeholders Orphans Complete de 6 1 0 0 83% pl 6 1 0 0 83% sv 6 1 1 0 83% 3 locale(s), 6 keys, 83% complete, 1 placeholder mismatches, 0 orphans … == sv == Missing keys (1): home.title Placeholder mismatches (1): billing.renews_on: "Renews on %{date}" -> "Förnyas {date}" [missing: rails:date] [unexpected: icu:date] Conflicting values (defined differently in several files) (1): checkout.cta: config/locales/pages/sv.yml, config/locales/app/sv.yml $ echo $? 1
What it catches
These bugs get past code review, since nobody reads every locale file. They get past tests too: nothing throws. Run check on every pull request to keep them out of main.
Missing translations
Strings that exist in your source language but are missing from a translation.
de.yml
checkout:
gift_card:
title: # in en.yml, missing here
Broken placeholders
%{name} or {{name}} turned into {name}, which your users see as raw code. Or a %s lost in translation, which drops the value from the sentence.
en.yml renews_on: "Renews on %{date}"
sv.yml renews_on: "Förnyas {date}"UI Förnyas {date}
en.json "renews": "Renews on {{date}}"
de.json "renews": "Verlängert am {date}"UI Verlängert am {date}
Missing plural forms
Polish and Russian need more than “one” and “other”. Without them, users see the wrong grammar. No error is raised.
pl.yml
files:
count:
one: "%{count} plik"
other: "%{count} pliku"
few: # needed for 2–4 files many: # needed for 5–21 files
Conflicting values
The same key with different text in two files of one language. Rails merges both files. The one loaded last wins, which can be the stale copy.
config/locales/app/sv.yml
checkout:
cta: "Gå till kassan"config/locales/pages/sv.yml
checkout:
cta: "Till kassan" # loaded last, wins
Use it in CI
Fails the build on missing translations, adds GitHub annotations to the pull request and exports JSON for your own tooling.
on: pull_request
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: npx @localheroai/cli check --source en --format github
| Flag | What it does |
|---|---|
--fail-on <rule> |
When to exit with an error: missing (default, missing or empty translations), placeholders, any or none |
--format github |
Errors and warnings as annotations on the pull request, at file level |
--json |
The full report on stdout, with stable keys |
--locales sv,de |
Only check these target languages |
--path <dir> |
The locale folder to scan. Without it, check looks in common folders such as config/locales, public/locales and src/locales |
--source en |
Set the source language instead of detecting it |
Keys that exist only in a translation are reported as warnings. They never fail the build.
Read the guide to checking locale files Every rule and option in the CLI README
Open source
The code is on GitHub under the MIT license. Read the rules, run it offline, send a pull request.
A false positive is a bug. If check flags something that isn't wrong, open an issue with the string and we'll fix the rule.
localheroai/cli
The Localhero.ai CLI. check is one of its commands. The same package runs translations for Localhero.ai customers.
Every rule and option in the CLI READMEWhy it's free
We build Localhero.ai, which translates product copy on every pull request. The first time we ran check on our own app, it found a broken placeholder in four languages. Any repo with locale files can have bugs like these. We made check free so anyone can look.
check
free, always- Finds missing translations, broken placeholders, missing plural forms and conflicting duplicates
- Runs offline, no account, no limits
- MIT licensed
translate
with a Localhero.ai account- Fills in missing translations on every pull request
- Follows your glossary and tone of voice
- A review page for your team, no git needed
See what's broken in your repo
Run it from the root of any repo with locale files.
npx @localheroai/cli check