Skip to main content
Glot is configured using a .glotrc.json file in your project root.

Creating Configuration

Run the init command to create a default configuration:
bash npx glot init
Or create .glotrc.json manually.

Quick Reference

OptionTypeDefaultDescription
primaryLocalestring"en"Primary locale for missing key detection
messagesDirstring"./messages"Path to locale JSON files
includesstring[]See belowDirectories to scan for TSX/JSX
ignoresstring[][]Paths or glob patterns to exclude
ignoreTestFilesbooleantrueSkip test files automatically
ignoreTextsstring[][]Text patterns to ignore
checkedAttributesstring[]See belowJSX attributes to check

Configuration Details

primaryLocale

primaryLocale

The primary locale for your application. Missing key detection uses this locale as the source of truth.
TypeDefault
string"en"
{
  "primaryLocale": "en"
}

messagesDir

Path to the directory containing your locale JSON files.
TypeDefault
string"./messages"
{
  "messagesDir": "./messages"
}
Expected structure:
messages/
├── en.json
├── es.json
├── fr.json
└── ...

includes

Directories to scan for TSX/JSX files. Glot only checks files in these directories.
TypeDefault
string[]See below
Default value:
{
  "includes": [
    "src/app/[locale]",
    "src/components",
    "app/[locale]",
    "components"
  ]
}
Glot supports two types of include patterns:Directory paths (without * or ?):Scans all files within the specified directory.
{
  "includes": ["src/app/[locale]", "src/components"]
}
Glob patterns (with * or ?):Uses glob matching to find directories to scan.
{
  "includes": ["src/*", "packages/*/src"]
}
Paths can include Next.js dynamic route syntax like [locale]. This is treated as a literal folder name, not a glob pattern.

ignores

Paths or glob patterns to exclude from scanning.
TypeDefault
string[][]
Glot supports two types of ignore patterns:Directory paths (without * or ?):Excludes the entire directory and all files within it. This works the same way as includes.
{
  "ignores": ["src/components/ai-elements", "src/generated"]
}
Glob patterns (with * or ?):Uses glob matching for more flexible patterns.
{
  "ignores": ["**/*.stories.tsx", "**/mocks/**"]
}
Mixed usage:You can combine both directory paths and glob patterns:
{
  "ignores": [
    "src/components/ai-elements",
    "src/generated",
    "**/*.stories.tsx",
    "**/node_modules/**"
  ]
}
Directory paths like src/components/ai-elements will exclude all files under that directory. Paths can include Next.js dynamic route syntax like app/[locale]/admin - the [locale] is treated as a literal folder name.

ignoreTestFiles

Skip test files automatically.
TypeDefault
booleantrue
When enabled, glot ignores:
  • *.test.tsx, *.test.ts, *.test.jsx, *.test.js
  • *.spec.tsx, *.spec.ts, *.spec.jsx, *.spec.js
  • Files in __tests__/ directories
{
  "ignoreTestFiles": true
}

ignoreTexts

Specific text patterns to ignore. Case-sensitive.
TypeDefault
string[][]
{
  "ignoreTexts": ["TODO", "FIXME", "Lorem ipsum"]
}
Useful for:
  • Development placeholders
  • Known patterns that don’t need translation
  • Third-party component text

checkedAttributes

JSX attributes to check for hardcoded text. These attributes commonly contain user-facing strings that should be translated.
TypeDefault
string[]See below
Default value:
{
  "checkedAttributes": [
    "placeholder",
    "title",
    "alt",
    "aria-label",
    "aria-description",
    "aria-placeholder",
    "aria-roledescription",
    "aria-valuetext"
  ]
}
Setting this option overrides the defaults. Include all attributes you want checked.

Full Example

A complete configuration file:
.glotrc.json
{
  "primaryLocale": "en",
  "messagesDir": "./locales",
  "includes": ["src/app/[locale]", "src/components", "src/features"],
  "ignores": ["**/node_modules/**", "**/*.stories.tsx", "**/mocks/**"],
  "ignoreTestFiles": true,
  "ignoreTexts": ["TODO", "FIXME", "N/A"],
  "checkedAttributes": ["placeholder", "title", "alt", "aria-label"]
}

Configuration Resolution

Glot searches for .glotrc.json starting from the specified path (or current directory) and traversing upward:
  1. Check current directory for .glotrc.json
  2. If not found, check parent directory
  3. Continue until:
    • A .glotrc.json is found
    • A .git directory is encountered (project root)
    • Filesystem root is reached
If no configuration is found, glot uses all default values.

Validation

Glot validates your configuration on startup:
  • Paths in includes are checked for existence
  • Glob patterns in ignores are validated
  • Invalid configuration shows clear error messages
Error: Invalid configuration in .glotrc.json
  - includes[0]: Directory "src/pages" does not exist
  - ignores[2]: Invalid glob pattern "***"

Common Configurations

{
  "primaryLocale": "en",
  "messagesDir": "./messages",
  "includes": [
    "src/app/[locale]",
    "src/components"
  ]
}
{
  "primaryLocale": "en",
  "messagesDir": "./locales",
  "includes": [
    "src/pages",
    "src/components"
  ]
}
{
  "primaryLocale": "en",
  "messagesDir": "./packages/i18n/messages",
  "includes": [
    "apps/web/src/app/[locale]",
    "apps/web/src/components",
    "packages/ui/src"
  ]
}