The .gleef/config.json file controls how Gleef CLI processes your localization files. This file is created automatically by gleef init but can be customized for complex project setups.

Configuration Location

The configuration file is always located at:
your-project/
└── .gleef/
    └── config.json
This file should be committed to version control so your team shares the same configuration.

Basic Configuration Structure

{
  "localeFilePatterns": [
    "src/locales/*.json",
    "public/i18n/*.json"
  ],
  "formatOptions": {
    "json": {
      "nested": true
    },
    "xml": {
      "nested": false
    }
  },
  "customFileNames": {
    "en-US": "english.json",
    "fr-FR": "french.json"
  }
}

Configuration Properties

localeFilePatterns

Type: string[]
Required: Yes
Defines glob patterns that match your localization files.
{
  "localeFilePatterns": [
    "src/locales/*.json",           // Basic pattern
    "public/i18n/**/*.json",        // Recursive pattern
    "assets/strings/*.strings",     // iOS strings files
    "!src/locales/config.json"      // Exclusion pattern
  ]
}
Pattern Examples:
PatternMatches
src/*.jsonsrc/en.json, src/fr.json
locales/**/*.jsonlocales/en/common.json, locales/fr/auth.json
*.{json,yaml}en.json, fr.yaml
!**/test.jsonExcludes any test.json files

formatOptions

Type: object
Required: No
Controls how different file formats are processed and generated.
{
  "formatOptions": {
    "json": {
      "nested": true
    },
    "xml": {
      "nested": false
    },
    "yaml": {
      "nested": true
    }
  }
}
Format-Specific Options:

JSON Options

  • nested (boolean): Use nested object structure vs flat keys

XML Options

  • nested (boolean): Use nested elements vs flat structure

YAML Options

  • nested (boolean): Use nested structure vs flat keys

Strings Options

None

customFileNames

Type: object
Required: No
Maps locale codes to specific file or folder names when they don’t follow standard naming conventions.
{
  "customFileNames": {
    "en-US": "english.json",
    "fr-FR": "french.json", 
    "es-ES": "spanish.json",
    "zh-CN": "chinese-simplified.json"
  }
}
Use Cases:
  • Legacy naming conventions
  • Simplified locale names (fr instead of fr-FR)
  • Descriptive filenames
  • Platform-specific naming requirements

Advanced Configuration Examples

Multi-Module Project

{
  "localeFilePatterns": [
    "apps/web/src/locales/*.json",
    "apps/mobile/assets/i18n/*.json", 
    "packages/shared/locales/*.json",
    "!**/*test*.json"
  ],
  "formatOptions": {
    "json": {
      "nested": true
    }
  }
}

Mixed Format Project

{
  "localeFilePatterns": [
    "src/locales/*.json",
    "ios/MyApp/*.lproj/*.strings",
    "android/app/src/main/res/values*/*.xml"
  ],
  "formatOptions": {
    "json": {
      "nested": true
    },
    "xml": {
      "nested": false
    }
  },
  "customFileNames": {
    "en-US": "LocalizableEn.strings",
    "fr-FR": "LocalizableFr.strings"
  }
}

Monorepo Configuration

{
  "localeFilePatterns": [
    "packages/*/src/locales/*.json",
    "apps/*/locales/**/*.json",
    "shared/i18n/*.{json,yaml}"
  ],
  "formatOptions": {
    "json": {
      "nested": true
    },
    "yaml": {
      "nested": true
    }
  }
}

File Structure Examples

Nested JSON (Default)

Configuration:
{
  "formatOptions": {
    "json": {
      "nested": true
    }
  }
}
Output:
{
  "auth": {
    "login": {
      "title": "Sign In",
      "email": "Email Address",
      "password": "Password"
    }
  },
  "navigation": {
    "home": "Home",
    "about": "About"
  }
}

Flat JSON

Configuration:
{
  "formatOptions": {
    "json": {
      "nested": false
    }
  }
}
Output:
{
  "auth.login.title": "Sign In",
  "auth.login.email": "Email Address", 
  "auth.login.password": "Password",
  "navigation.home": "Home",
  "navigation.about": "About"
}

XML Structure

Configuration:
{
  "formatOptions": {
    "xml": {
      "nested": false
    }
  }
}
Output:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
  <string name="auth_login_title">Sign In</string>
  <string name="auth_login_email">Email Address</string>
  <string name="navigation_home">Home</string>
</resources>

Configuration Validation

Common Validation Errors

Invalid Pattern:
Error: Pattern 'src/**.json' is invalid. Use 'src/**/*.json' for recursive matching.
No Files Matched:
Warning: Pattern 'locales/*.json' matched no files. Check your file structure.
Format Conflict:
Error: File 'en.json' matches multiple patterns with different format options.

Troubleshooting

Configuration Issues

No files detected:
  • Check pattern syntax
  • Verify file paths are correct
  • Test patterns with file system tools
Wrong files included:
  • Add exclusion patterns
  • Make patterns more specific
  • Check for conflicting patterns
Format errors:
  • Validate JSON syntax
  • Check property names and values
  • Review format-specific options

Recovery

Reset configuration:
rm -rf .gleef/
gleef init

Next Steps