Hardcoded Text Detection
JSX Text Nodes
Glot detects text content in JSX elements:JSX Expression Containers
String literal - detected:Checked Attributes
By default, glot checks these attributes for hardcoded text:placeholder- Input placeholder texttitle- Tooltip/title textalt- Image alternative textaria-label- Accessibility labelaria-description- Accessibility descriptionaria-placeholder- Accessibility placeholderaria-roledescription- Accessibility role descriptionaria-valuetext- Accessibility value text
Skipped Patterns
The following are NOT reported as hardcoded text: Pure numbers - no alphabetic characters:ignoreTexts config.
Text Detection Rules
Glot uses Unicodechar::is_alphabetic() to determine if text should be reported. This means:
- All languages are supported (English, Chinese, Japanese, Arabic, etc.)
- Text must contain at least one alphabetic character
- Numbers and symbols alone are ignored
Translation Function Tracking
Glot tracks how translation functions (t) are obtained and used throughout your codebase.
Direct Binding
The most common pattern - callinguseTranslations or getTranslations directly:
Props Passing
When a translation function is passed as a prop to a child component:Function Call Arguments
When a translation function is passed to a utility/factory function:Translation Method Calls
All next-intl translation methods are supported:Dynamic Key Resolution
Glot can resolve dynamic keys in many common patterns.Object Access Pattern
When a key comes from an object property:Array Iteration
Supported iterator methods:map, forEach, filter, find, some, every, flatMap
Object array with property access:
Template Literals
Templates with a single dynamic expression are analyzed:Conditional Expressions
Both branches of conditionals are extracted:Cross-File Import Resolution
Glot resolves imports from other files:Only module-level, exported declarations are resolved across files.
Schema Factory Pattern
Glot detects translation keys in schema factory functions (commonly used with Zod):- Arrow function exports:
export const createSchema = (t) => ... - Parameter names starting with
t:t,tForm,tValidation - Nested schema calls are tracked
Scope Isolation
Glot correctly handles variable scoping and shadowing.Parameter Shadowing
Inner bindings shadow outer ones:Sibling Function Isolation
Translation bindings don’t leak between sibling functions:Iterator Scope
Nested iterators with same variable names are handled correctly:glot-message-keys Annotation
For dynamic keys that can’t be statically analyzed, useglot-message-keys to declare expected keys. This tells glot which keys are actually used, enabling safe cleanup with glot clean and suppressing unresolved key warnings.
glot fix --apply.
Limitations
Patterns That Cannot Be Tracked
These patterns cannot be tracked by static analysis and have no workaround: Non-destructured props - use destructuring instead:Patterns Requiring Declaration
These patterns cannot be statically analyzed but can be handled withglot-message-keys:
Multi-expression template:
Feature-Specific Limitations
Cross-file key object resolution: Objects with spread operators are not collected for cross-file resolution:t() calls are unaffected.
Schema factory detection:
Only arrow function exports are supported: