Skip to main content
Severity: Warning — does not affect exit code or fail CI builds.
Glot detects translation keys that are defined in your locale files but never used in your code.

Types of Orphan Keys

Unused Keys

Keys that exist in locale files but are never referenced in code:
messages/en.json

Replica Orphans

Keys that exist in non-primary locales but not in the primary locale. This typically happens when:
  • A key was deleted from the primary locale but not from other locales
  • A key was accidentally added to a non-primary locale
The term “replica lag” refers to the synchronization gap between your primary and secondary locales:
messages/en.json (primary)
messages/es.json

Why This Matters

Orphan keys:
  • Increase translation file size unnecessarily
  • Cause confusion for translators
  • May indicate incomplete code cleanup
  • Add maintenance burden

Severity

Orphan keys are reported as warnings (not errors) because:
  • They don’t break functionality
  • They may be intentionally kept for future use
  • Removal is optional

Running Orphan Detection

bash npx glot check orphan
Output:

Cleaning Up Orphan Keys

Use the clean command to remove orphan keys:

Clean Only Specific Types

Common Causes

Removed Features

A feature was removed but translations weren’t cleaned up:

Refactored Keys

Keys were renamed but old ones weren’t removed:

Copy-Paste Locales

Locale files copied from another project with unused keys.

Keeping Keys Intentionally

If you want to keep certain keys without using them (e.g., for future features), you can:
  1. Add a comment (though glot will still report them)
  2. Reference them in a special file that glot ignores
  3. Accept the warnings as informational

Dynamic Keys Warning

If your code uses dynamic translation keys, glot cannot determine if a key is truly unused:
In this case, clean will refuse to run to prevent accidental deletion.

Clean Command

Remove orphan keys

Missing Keys

Find missing translation keys