What you get
The Keyglot CLI scans your React components for hardcoded user-facing text, extracts it into
translation resources, and keeps the result in sync with the Keyglot cloud. keyglot check
turns the same data into a localization health report you can run in CI.
The react-i18next adapter understands useTranslation bindings, aliased destructuring,
nested component shadowing, the ns:key prefix, and option overrides — so existing apps work
without refactoring first.
1. Install and initialize
init inspects package.json, picks the react-i18next adapter, and writes
keyglot.config.jsonc plus a starter resource file at src/locales/en/common.json. Use
--source-locale if your source language is not English:
The generated configuration:
Point include at your source tree and resourcePattern at wherever your translation files
live. Patterns are relative to the directory that contains the configuration, and every
workspace command finds that configuration automatically from any nested directory, so
monorepos work out of the box.
2. Find and extract hardcoded text
Preview what the scanner found:
Every command is a dry run unless you pass --write. Extract the high-confidence findings:
The transform imports useTranslation, wires the namespace, and replaces the literal with a
t() call, preserving interpolations:
Individual candidates can be applied selectively with --candidate ID.
3. Connect to the Keyglot cloud
Create a project in Keyglot, then link the workspace:
Set a project API token for the sync commands (Project settings → API tokens):
Then pull the current working copy, push local edits, or both:
push never archives cloud-only keys, so nothing disappears by accident.
4. Publish
When the working copy looks right, cut a development publication and promote it to production:
Publications are immutable and atomic; --wait blocks until the build is ready. Use
npx keyglot status to inspect the active publications at any time.
5. Run the health check in CI
The report covers hardcoded text, missing keys, unused keys, missing translations, placeholder mismatches, plural inconsistencies, and drift between your local resources and the active production publication.
For GitHub Actions, emit workflow annotations and fail only on the categories you care about:
Budgets keep legacy debt from blocking every build:
The same settings live in the check section of keyglot.config.jsonc:
By default every category except unused-keys fails the build; --fail-on none,
--fail-on all, and per-category budgets are available as flags.
Key conventions
- Namespaces come from
useTranslation('ns'), thens:keyprefix, or the{ ns }option; unnamespaced calls use the configured default namespace. - Interpolations use
{{name}}placeholders.checkcompares placeholder sets across locales and fails when they differ. - Plurals use the
_zero,_one,_two,_few,_many,_othersuffixes on a shared base key. Every plural family needs_otheras the fallback;checkverifies this per locale. - Key style is
nestedorflat(a.b.cas a single key), configured in the sink and overridable with--key-styleon pull, push, and diff.