DEV Community

Cover image for i18n-doctor: Find Unused, Missing, and Hardcoded Translation Keys in JS/TS
taha farzalizadeh
taha farzalizadeh

Posted on

i18n-doctor: Find Unused, Missing, and Hardcoded Translation Keys in JS/TS

Internationalization (i18n) breaks quietly. Keys rot in locale files. Screens ship with English hardcoded in JSX. Another locale is missing half the catalog. Most teams only notice this in production — or never.
i18n-doctor is an open-source static analyzer for JavaScript and TypeScript that finds those problems without running your app.

One-line definition: i18n-doctor checks your source and locale files for unused keys, missing keys, duplicates, cross-locale gaps, and untranslated UI text — then reports them in the CLI or live in your editor.

The problem i18n-doctor solves

Modern frontends rarely call t("key") in one simple place. Keys are:

  • passed down as props ({ t }, props.t)
  • built from static pieces ("HELLO_" + "AGAIN")
  • partly dynamic (t("HELLO_" + suffix))
  • mixed across React, Vue, Angular, Next.js, i18next, react-intl, vue-i18n, next-intl, Lingui, and more Regex scripts and “search the repo” workflows miss those patterns. Manual review does not scale. Locale files grow, CI stays green, and translation debt compounds. ## Why I built it I kept hitting the same gap: great i18n libraries, but weak hygiene tooling that understands real usage — including IDE feedback while you type, not only a CI script after the fact. So I built i18n-doctor as:
  • a CLI you can run with npx or in CI
  • a shared language server
  • thin VS Code and JetBrains / WebStorm plugins on top of that server Same analyzer everywhere — terminal, PR checks, and the editor.

What it detects today

Finding Meaning
Unused keys Defined in locales, never referenced in code
Missing keys Used in code, missing from locales
Duplicate keys Same key defined more than once
Cross-locale gaps Present in one locale, absent in another
Untranslated text Hardcoded JSX / UI strings that never go through a translator (info by default)

It also handles harder static cases:

  • prop-passed translators
  • statically concatenated keys
  • soft “may be unused” hints when a dynamic usage might still cover a key Analysis is static only — no runtime, no bundler, no side effects. ## Try it in 10 seconds
npx i18n-doctor check
Enter fullscreen mode Exit fullscreen mode

Or install as a dev dependency and wire a script:

npm install -D i18n-doctor
# package.json → "i18n:check": "i18n-doctor check"
Enter fullscreen mode Exit fullscreen mode

And the result:

· Discovering project…
· Loading configuration…
· Detecting framework…
· Collecting sources & usages…
· Analyzing locale coverage…
✓ Done (2376ms)
i18n-doctor issues
Root: PATH/TO/YOUR/PROJECT

Summary
  Unused:    1152
  Missing:   34
  Duplicate: 3
  Total:     1189

Locale coverage
  Base: en  Locales: en, fa
  Coverage: 99.56%
  Missing in other langs: 18
  Extra (not in base): 17
  en  100%  (2040/2040 keys)
  fa  99.1%  (2022/2040 keys)

"and the unused or duplicated keys locations here"
Enter fullscreen mode Exit fullscreen mode

Prefer live underlines while editing? Install the editor extension (bundled language server — no project dependency required):

  • VS Code Marketplace → search i18n-doctor
  • JetBrains Marketplace → search i18n-doctor

Development path (where this is going)

i18n-doctor is currently in beta (v0.9.x). The path so far:

  1. Core analyzer — unused / missing / duplicate / coverage
  2. CLI + reports — terminal, JSON, SARIF, Markdown, HTML
  3. Language server — shared engine for editors
  4. VS Code + JetBrains plugins — live diagnostics
  5. Smarter usages — prop-passed t, static composition, dynamic softening, untranslated UI text Next focus areas: more frameworks and edge cases, better suppressions/config ergonomics, and IDE features beyond diagnostics (hover / actions) when the analyzer is solid enough. Feedback from real projects is the fastest way to stabilize toward v1. ## Who should use it
  6. Teams shipping multi-locale React / Vue / Next / Angular apps
  7. Maintainers cleaning up large locale JSON / catalogs
  8. Anyone who wants i18n checks in CI and the editor from one tool If your translations matter to users, your keys deserve the same static scrutiny as TypeScript types. ## Links
  9. GitHub: https://github.com/taha-farzalizadeh/i18n-doctor
  10. npm (i18n-doctor / CLI): https://www.npmjs.com/package/i18n-doctor
  11. Issues / feedback: https://github.com/taha-farzalizadeh/i18n-doctor/issues
  12. VS Code extension: search i18n-doctor on the Visual Studio Marketplace
  13. JetBrains / WebStorm plugin: search i18n-doctor on the JetBrains Marketplace If you try it on your repo, open an issue with what it missed — that feedback shapes the beta. ---

Top comments (1)

Collapse
 
sylthevester_c9b1914196d3 profile image
sylthevester •

nice