Configuration Overview
The Composer Translation Validator can be configured in multiple ways to customize validation behavior.
Configuration Methods
1. Command Line Arguments
Pass options directly to the command:
composer validate-translations ./translations --strict --format jsonSee CLI Reference for all available options.
2. Configuration File
Create a dedicated configuration file in your project root. The plugin supports multiple formats:
translation-validator.php- PHP configurationtranslation-validator.json- JSON configurationtranslation-validator.yaml- YAML configurationtranslation-validator.yml- YAML configuration (alternative extension)
See Configuration File for detailed examples.
3. composer.json Reference
Specify a custom configuration file path in composer.json:
{
"extra": {
"translation-validator": {
"config-file": "./config/translation-validator.yaml"
}
}
}Auto-Detection
The plugin automatically searches for configuration files in this order:
translation-validator.jsontranslation-validator.yamltranslation-validator.yml
The first file found will be used.
PHP configuration files are not auto-detected, because they are executed when loaded. Auto-loading one from an untrusted working directory would allow arbitrary code execution. To use a PHP configuration file, reference it explicitly via the --config option or the composer.json config-file entry.
Configuration Priority
When the same option is specified in multiple places, this priority applies:
- Command line arguments (highest priority)
- Configuration file
- Default values (lowest priority)
Opt-In Validators
INFO
The DuplicateValuesValidator and the KeyNamingConventionValidator are disabled by default to reduce noise in validation results:
- DuplicateValuesValidator — duplicate values are often intentional (e.g., common button labels like "OK" or "Cancel").
- KeyNamingConventionValidator — auto-detected naming conventions frequently produce false positives on mixed but intentional key styles.
To enable one of them, either:
- Use
--onlyto explicitly include it - Set
skip: []in your configuration file (enables all validators)
Next Steps
- Configuration File - Detailed format examples
- Schema Reference - All available options