Skip to main content
The init command creates a default .glotrc.json configuration file in your project root.

Usage

npx glot init

What It Creates

Running glot init creates a .glotrc.json file with sensible defaults:
{
  "primaryLocale": "en",
  "messagesDir": "./messages",
  "includes": [
    "src/app/[locale]",
    "src/components",
    "app/[locale]",
    "components"
  ],
  "ignores": [],
  "ignoreTestFiles": true,
  "ignoreTexts": [],
  "checkedAttributes": [
    "placeholder",
    "title",
    "alt",
    "aria-label",
    "aria-description",
    "aria-placeholder",
    "aria-roledescription",
    "aria-valuetext"
  ]
}

Behavior

  • Creates the file in the current directory
  • Fails if .glotrc.json already exists (won’t overwrite)
  • Uses defaults suitable for typical Next.js projects

Example

$ npx glot init
Created .glotrc.json

$ cat .glotrc.json
{
"primaryLocale": "en",
"messagesDir": "./messages",
...
}

After Initialization

After creating the config file, you should:
1

Review Paths

Check that includes matches your project structure. Adjust paths if your components are in different directories.
2

Set Primary Locale

Change primaryLocale if your primary language isn’t English.
3

Set Messages Directory

Update messagesDir to point to your locale JSON files.
4

Run Check

Test your configuration:
npx glot check

Configuration

Full configuration reference