Skip to main content
Severity: Warning — does not affect exit code or fail CI builds.
Glot detects translation keys that cannot be statically analyzed because they use variables, template literals with expressions, or other dynamic patterns.

Detection Rule

A translation key is flagged as unresolved if it:
  1. Uses a variable as the key argument: t(variableName)
  2. Uses a template literal with expressions: t(`prefix.${dynamic}`)
  3. Uses computed properties: t(keys[index])
  4. Uses function calls: t(getKey())
  5. Is not covered by a glot-message-keys annotation
Unresolved keys can’t be checked for existence, potentially causing missing-key errors at runtime.
In Astro frontmatter, use // glot-message-keys "..." for declarations. In Astro templates, use <!-- glot-message-keys "..." -->.

What Gets Detected

Variable Keys

Keys stored in variables:

Template Literals

Template strings with dynamic expressions:

Computed Properties

Array or object access:

Function Calls

Keys returned from functions:

Output Format

The warning indicates the location but can’t show the actual key since it’s computed at runtime.

Severity

Warning - Unresolved keys are informational because:
  • They might be valid at runtime
  • They could lead to missing-key errors
  • Glot cannot verify if the keys exist in locale files
  • They prevent other checks like unused and orphan from running safely

Why This Matters

Static Analysis Limitations

Glot can’t verify unresolved keys exist:
If action is “submit”, the key works. If it’s “submet” (typo), you get a runtime error that glot can’t detect.

Prevents Cleanup

Unresolved keys block glot clean:
This is a safety feature to prevent accidentally deleting keys that are used dynamically.

Incomplete Coverage

Other checks can’t analyze unresolved keys:
Missing keys only appear at runtime, not during static analysis.

How to Fix

Declare the possible keys explicitly:
Now glot can verify these keys exist and track their usage.

Option 2: Use Glob Patterns

For many similar keys, use wildcards:
Glot will match any key like errors.404.message, errors.500.message, etc.

Option 3: Use glot fix Command

Automatically insert annotations:
The fix command analyzes your code and template patterns to suggest appropriate annotations.

Option 4: Refactor to Static Keys

When possible, use static keys with conditionals:
While the object lookup is still dynamic, you can annotate it once:

glot-message-keys Annotation

Use glot-message-keys comments to declare which keys a dynamic expression uses:
Place annotations before the dynamic key usage. For full syntax reference (relative patterns, glob matching, JS/JSX/HTML comments, multiple annotations), see Directives — Dynamic Key Declaration.

Common Patterns

Status Messages

Error Messages

Dynamic Pages

Pluralization (Avoid Dynamic Keys)

Don’t use dynamic keys for plurals:

Examples

Before (unresolved):
After (resolved):
Now glot can:
  • Verify order.status.pending, order.status.shipped, etc. exist
  • Check that keys aren’t orphaned
  • Enable glot clean to safely remove unused keys
Before (unresolved):
After (resolved):

Best Practices

1. Minimize Dynamic Keys

Prefer static keys when possible:

2. Document Patterns

Explain complex patterns in comments:

3. Keep Annotations Close

Place annotations near the code they describe:

4. Use TypeScript for Safety

Combine with TypeScript for type-safe keys:

Check Command

Run unresolved key detection

Fix Command

Auto-insert message key annotations

Directives

glot-message-keys syntax reference

Missing Keys

Keys used but not defined