Severity: Warning — does not affect exit code or fail CI builds.
Detection Rule
A translation key is flagged as unresolved if it:- Uses a variable as the key argument:
t(variableName) - Uses a template literal with expressions:
t(`prefix.${dynamic}`) - Uses computed properties:
t(keys[index]) - Uses function calls:
t(getKey()) - Is not covered by a
glot-message-keysannotation
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
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
unusedandorphanfrom running safely
Why This Matters
Static Analysis Limitations
Glot can’t verify unresolved keys exist: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 blockglot clean:
Incomplete Coverage
Other checks can’t analyze unresolved keys:How to Fix
Option 1: Add glot-message-keys Annotation (Recommended)
Declare the possible keys explicitly:
Option 2: Use Glob Patterns
For many similar keys, use wildcards:errors.404.message, errors.500.message, etc.
Option 3: Use glot fix Command
Automatically insert annotations:
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:glot-message-keys Annotation
Useglot-message-keys comments to declare which keys a dynamic expression uses:
Common Patterns
Status Messages
Error Messages
Dynamic Pages
Pluralization (Avoid Dynamic Keys)
Don’t use dynamic keys for plurals:Examples
Before and After: Status Component
Before and After: Status Component
Before (unresolved):After (resolved):Now glot can:
- Verify
order.status.pending,order.status.shipped, etc. exist - Check that keys aren’t orphaned
- Enable
glot cleanto safely remove unused keys
Complex Dynamic Pattern
Complex Dynamic Pattern
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:Related
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