Skip to main content
Severity: Error — causes exit code 1 and fails CI builds.
Glot detects translation keys that are used in your code but missing from your locale files.

What Are Missing Keys?

A missing key occurs when:
  1. Your code calls a translation function with a key: t('common.submit')
  2. That key doesn’t exist in your locale JSON files
This typically happens when:
  • A developer adds a translation call but forgets to add the key to locale files
  • A key is misspelled in the code
  • Keys are deleted from locale files but still used in code

Example

Code using a translation:
Locale file missing the key:
messages/en.json
Glot output:

Detection Methods

Glot identifies translation usage through:

Direct Function Calls

Template Literals (Warning)

Dynamic keys can’t be statically analyzed:

Supported Translation Hooks

Glot recognizes these next-intl translation functions:
Custom translation functions or renamed imports are not automatically detected. If you use a wrapper function, consider using glot-message-keys to declare keys.

Severity

Missing keys are reported as errors because they cause runtime issues:
  • In development: Often shows the key itself or an error message
  • In production: Can break the user experience

Fixing Missing Keys

1

Run Check

2

Review Issues

Check each missing key report to understand what’s needed.
3

Add Keys

Add the missing keys to your locale files:
messages/en.json
4

Verify

Run the check again to confirm all keys are present:

Dynamic Keys

When glot encounters dynamic keys, it issues a warning:

Handling Dynamic Keys

Options for handling dynamic keys:
  1. Refactor to static keys (recommended):
  2. Declare expected keys (when refactoring is not feasible):
    Or use a glob pattern to match multiple keys:
    Use glot fix to automatically insert these comments:
    See glot fix for details.
  3. Suppress the warning (last resort):
Option 2 (glot-message-keys) is preferred over option 3 because it explicitly declares which keys are used, enabling accurate tracking for the clean command.

Primary vs Non-Primary Locales

Missing key detection checks against the primary locale defined in your config:
.glotrc.json
If a key is missing from messages/en.json, it’s reported as a missing key. If a key exists in en.json but not in es.json, it’s reported as replica lag (a different check).

Directives

Use glot-message-keys for dynamic keys

Orphan Keys

Find unused translation keys

Check Command

Run missing key detection