check command is the core of glot. It scans your codebase for internationalization issues.
Usage
Check Types
You can run specific checks or all checks at once:| Type | Description |
|---|---|
hardcoded | Find untranslated text in JSX/TSX files |
missing | Identify translation keys used in code but missing from locale files |
orphan | Find keys in non-primary locales not present in primary locale |
untranslated | Find values identical to primary locale that may need translation |
unused | Find keys in primary locale that are not used in code |
replica-lag | Find keys in primary locale missing from other locales |
type-mismatch | Find type conflicts between primary and replica locales (string vs array) |
unresolved | Find keys that cannot be statically resolved (variables, template literals) |
Severity
Each check type has a fixed severity level. Errors cause a non-zero exit code (exit 1); warnings do not.| Type | Severity | Exit Code |
|---|---|---|
hardcoded | Error | 1 |
missing | Error | 1 |
type-mismatch | Error | 1 |
orphan | Warning | 0 |
untranslated | Warning | 0 |
unused | Warning | 0 |
replica-lag | Warning | 0 |
unresolved | Warning | 0 |
Options
Override the source code root directory. Defaults to the value from configuration file.
Override the messages directory path. Defaults to the value from configuration file.
Override the primary locale. Defaults to the value from configuration file.
Enable verbose output for debugging.
Examples
Basic Check
Check the current directory for all i18n issues:Override Source Root
Check a specific source directory:Verbose Mode
Get detailed output including scanned files:Check Specific Issue Types
Run only hardcoded text detection:Output Format
Glot displays issues in a compiler-like format:Issue Severity
| Severity | Exit Code | Description |
|---|---|---|
| Error | 1 | Hardcoded text, missing keys, type mismatches |
| Warning | 0 | Orphan keys, untranslated values, unused keys, replica-lag, unresolved keys |
Understanding Issues
Each issue type is documented in detail on its own page. Here’s a quick summary:| Issue Type | Severity | Description | Details |
|---|---|---|---|
hardcoded-text | Error | User-facing text not wrapped in t() | Hardcoded Text |
missing-key | Error | Key used in code but not defined in locale files | Missing Keys |
type-mismatch | Error | Value type differs between locales (causes runtime crashes) | Type Mismatch |
orphan-key | Warning | Key in non-primary locale but not in primary | Orphan Keys |
untranslated | Warning | Value identical to primary locale | Untranslated |
unused-key | Warning | Key in primary locale but never used in code | Unused Keys |
replica-lag | Warning | Key in primary locale missing from other locales | Replica Lag |
unresolved-key | Warning | Dynamic key that can’t be statically analyzed | Unresolved Keys |
Quick Fix Guide
Hardcoded text → Replace witht() call, or suppress with glot-disable-next-line. See Hardcoded Text.
Missing keys → Add the key to your locale file, or fix typos. See Missing Keys.
Type mismatches → Ensure all locales use the same type (string/array/object). See Type Mismatch.
Orphan keys → Add to primary locale or remove with glot clean --apply. See Orphan Keys.
Unused keys → Remove with glot clean --apply. See Unused Keys.
Replica lag → Add missing translations to non-primary locales. See Replica Lag.
Unresolved keys → Add glot-message-keys annotations or run glot fix --apply. See Unresolved Keys.
Exit Codes
| Code | Meaning |
|---|---|
| 0 | No errors found (warnings may exist) |
| 1 | Errors found |
Verbose Output
With-v flag, glot shows additional information:
CI Examples
Glot works well in CI pipelines. Here are GitHub Actions examples:Related
Hardcoded Text
Detect untranslated text in JSX/TSX
Missing Keys
Find keys used but not defined
Orphan Keys
Find unused translation keys in non-primary locales
Untranslated Values
Find values that may need translation
Unused Keys
Find keys in primary locale not used in code
Replica Lag
Find keys missing from replica locales
Type Mismatch
Find type conflicts between locales
Unresolved Keys
Find keys that cannot be statically resolved
Directives
Suppress specific warnings