gleef init
command sets up Gleef in your project by guiding you through the configuration process and creating the necessary configuration file.
Usage
What it does
Theinit
command performs several important setup tasks:
- Prompts for locale file patterns using placeholder syntax (e.g.,
{locale}
,{feature}
) - Validates your file patterns by attempting to load locale files
- Fetches company locales from your Gleef account
- Maps file/folder names to company locales when needed
- Creates configuration in
.gleef/config.json
with proper format options - Sets up custom locale mappings when file names don’t match standard locale codes
Placeholder Patterns
The command uses placeholder syntax to define file patterns:{locale}
- Required placeholder for the locale identifier{feature}
or{namespace}
- Optional placeholders for organizing translations
Supported File Formats
Gleef supports these localization file formats:.json
- JSON localization files.xml
- XML localization files.yaml
/.yml
- YAML localization files.strings
- iOS strings files
Pattern Examples
Pattern | Matches | Use Case |
---|---|---|
src/locales/{locale}.json | src/locales/en.json , src/locales/fr.json | Simple locale files |
public/i18n/{locale}/{feature}.json | public/i18n/en/common.json , public/i18n/fr/auth.json | Namespaced translations |
locales/{feature}.{locale}.json | locales/common.en.json , locales/auth.fr.json | Feature-first organization |
Interactive Setup Process
Step 1: Enter Locale File Pattern
Step 2: Locale Mapping (if needed)
If your file/folder names don’t match your company locales:Step 3: Success
Generated Configuration
After runninginit
, you’ll find a .gleef/config.json
file in your project:
Configuration Properties
Property | Description |
---|---|
localeFilePatterns | Placeholder patterns matching your localization files using {locale} syntax |
formatOptions | Output format settings for each file type (auto-detected based on your patterns) |
customLocaleNames | Maps company locale codes to your file/folder names when they don’t match |
Configuration Examples by Technology
Complex Project Structures
Monorepo with Multiple Apps
Legacy Project with Custom Names
Troubleshooting
Pattern Validation Errors
If the pattern validation fails:⚠ No locale files found with this path
Please correct your path, check the documentation or contact Gleef for help.
- Missing
{locale}
placeholder - All patterns must include{locale}
- Incorrect file paths - Verify the files exist at the specified location
- Wrong file extensions - Ensure files use
.json
,.xml
,.yaml
, or.strings
- Path syntax errors - Use forward slashes
/
in patterns
Locale Mapping Issues
If your file/folder names don’t match company locales:- Use the interactive mapping - The init command will prompt you to map each unmatched locale
- Skip unmapped locales - Choose “Skip” for locales you don’t want to include
- Update company locales - Add missing locales in Gleef Studio if needed
Manual Configuration
If you need to skip the interactive setup:Best Practices
Always use the
{locale}
placeholder in your file patterns for proper locale detection.- Use descriptive patterns - Include folder structure in patterns:
src/i18n/{locale}/{feature}.json
- Test your patterns - Verify patterns match existing files before running init
- Plan for namespaces - Consider using
{feature}
placeholders for organized translations - Review generated config - Check
.gleef/config.json
matches your expectations - Commit configuration - Add
.gleef/config.json
to version control