Skip to main content
Glot uses static analysis to detect i18n issues in your codebase. This page documents all supported patterns and known limitations.

Hardcoded Text Detection

JSX Text Nodes

Glot detects text content in JSX elements:

JSX Expression Containers

String literal - detected:
Ternary expression - both branches checked:
Logical AND - right side checked:
Logical OR - right side checked:
Template literal - static parts checked:

Checked Attributes

By default, glot checks these attributes for hardcoded text:
  • placeholder - Input placeholder text
  • title - Tooltip/title text
  • alt - Image alternative text
  • aria-label - Accessibility label
  • aria-description - Accessibility description
  • aria-placeholder - Accessibility placeholder
  • aria-roledescription - Accessibility role description
  • aria-valuetext - Accessibility value text
Customize checked attributes via checkedAttributes in .glotrc.json.

Skipped Patterns

The following are NOT reported as hardcoded text: Pure numbers - no alphabetic characters:
Pure symbols - no alphabetic characters:
Empty/whitespace - no content:
Style tag content - CSS code:
Configured ignores - text matching patterns in ignoreTexts config.

Text Detection Rules

Glot uses Unicode char::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 - calling useTranslations or getTranslations directly:

Props Passing

When a translation function is passed as a prop to a child component:
Member expression component names are also supported:

Function Call Arguments

When a translation function is passed to a utility/factory function:
Supported patterns:

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:
String array:

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):
Supported patterns:
  • 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, use glot-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.
You can also auto-insert these annotations with glot fix --apply.
For full syntax (absolute patterns, relative patterns, glob matching, JSX comments), see Directives — Dynamic Key Declaration.

Limitations

Patterns That Cannot Be Tracked

These patterns cannot be tracked by static analysis and have no workaround: Non-destructured props - use destructuring instead:
Deep nested destructuring - use top-level destructuring:

Patterns Requiring Declaration

These patterns cannot be statically analyzed but can be handled with glot-message-keys: Multi-expression template:
Logical AND as key:
Runtime dynamic key:

Feature-Specific Limitations

Cross-file key object resolution: Objects with spread operators are not collected for cross-file resolution:
This only affects dynamic key resolution via object access patterns. Direct t() calls are unaffected. Schema factory detection: Only arrow function exports are supported:

TypeScript Support

Glot automatically unwraps TypeScript-specific syntax: