.glotrc.json file in your project root.
Creating Configuration
Run the init command to create a default configuration:- npm
- pnpm
- yarn
- bun
bash npx glot init .glotrc.json manually.
Quick Reference
Configuration Details
primaryLocale
primaryLocale
messagesRoot
messagesRoot
messagesRoot
Path to the directory containing your locale JSON files.For backward compatibility,
messagesDir is also accepted as an alias.sourceRoot
sourceRoot
sourceRoot
The root directory for source code scanning. Paths inincludes are relative to this directory.includes
includes
includes
Directories to scan for source files. Glot only checks.tsx, .jsx, .ts, .js, and supported .astro files in these directories.Default value:
* or ?):Scans all files within the specified directory.* or ?):Uses glob matching to find directories to scan.Paths can include Next.js dynamic route syntax like
[locale]. This is
treated as a literal folder name, not a glob pattern.ignores
ignores
ignores
Paths or glob patterns to exclude from scanning.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.* or ?):Uses glob matching for more flexible patterns.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
ignoreTestFiles
ignoreTestFiles
Skip test files automatically.When enabled, glot ignores:
*.test.tsx,*.test.ts,*.test.jsx,*.test.js*.spec.tsx,*.spec.ts,*.spec.jsx,*.spec.js- Files in
__tests__/directories
ignoreTexts
ignoreTexts
ignoreTexts
Specific text patterns to ignore. Case-sensitive.- Development placeholders
- Known patterns that don’t need translation
- Third-party component text
checkedAttributes
checkedAttributes
checkedAttributes
JSX attributes to check for hardcoded text. These attributes commonly contain user-facing strings that should be translated.Default value:
severities
severities
severities
Override the effective severity for specific rules."error" and "warning".Supported rule keys:hardcodedmissingormissing-keyreplica-laguntranslatedtype-mismatchunusedorunused-keyorphanororphan-keyunresolvedorunresolved-key
untranslated is an error by default when the key is used in source, and a
warning when no source usage is found. If your project intentionally keeps
some used values identical across locales, prefer targeted
glot-disable-next-line untranslated comments. Use severities when you want
a project-wide policy change.extraTranslationCallees
extraTranslationCallees
extraTranslationCallees
Additional bare callee names to treat as translation usage.extraTranslationMemberCalls
extraTranslationMemberCalls
extraTranslationMemberCalls
Additional constrained member-call patterns to treat as translation usage.Each entry supports these fields:
property(required): member name such astranslateobjectName(optional): local object name such asintlimportFrom(optional): restrict to a specific import sourceimportName(optional): restrict to a specific imported binding such asdefault,*, or a named export
objectName or importFrom is required..t(...) call as a translation usage.Full Example
A complete configuration file:.glotrc.json
Configuration Resolution
Glot searches for.glotrc.json starting from the specified path (or current directory) and traversing upward:
- Check current directory for
.glotrc.json - If not found, check parent directory
- Continue until:
- A
.glotrc.jsonis found - A
.gitdirectory is encountered (project root) - Filesystem root is reached
- A
Validation
Glot validates your configuration on startup:- Paths in
includesare checked for existence - Glob patterns in
ignoresare validated - Invalid configuration shows clear error messages
Common Configurations
Next.js App Router
Next.js App Router
Next.js Pages Router
Next.js Pages Router
Monorepo with Multiple Apps
Monorepo with Multiple Apps
Related
Init Command
Create configuration file
Directives
Inline suppression directives