move-elevator / composer-translation-validator
A Composer plugin that validates translations files in your project regarding mismatches between language source and target files.
Installs: 88
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 1
Type:composer-plugin
Requires
- php: ^8.1
- composer-plugin-api: ^1.0 || ^2.0
- ext-libxml: *
- ext-simplexml: *
- psr/log: ^2.0 || ^3.0
- symfony/config: ^5.0 || ^6.0 || ^7.0
- symfony/console: ^5.0 || ^6.0 || ^7.0
- symfony/filesystem: ^5.0 || ^6.0 || ^7.0
- symfony/translation: ^5.0 || ^6.0 || ^7.0
- symfony/yaml: ^5.0 || ^6.0 || ^7.0
Requires (Dev)
- armin/editorconfig-cli: ^1.0 || ^2.0
- composer/composer: ^2.0
- eliashaeussler/rector-config: ^3.0
- ergebnis/composer-normalize: ^2.44
- friendsofphp/php-cs-fixer: ^3.52
- phpstan/phpstan: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-symfony: ^2.0
- phpunit/phpunit: ^10.2 || ^11.0 || ^12.0
- roave/security-advisories: dev-latest
This package is auto-updated.
Last update: 2025-07-08 08:03:52 UTC
README
Composer Translation Validator
A Composer plugin that validates translation files in your project.
Provides a command validate-translations
to check for translations mismatches, duplicates and schema validation.
✨ Features
- Autodetect coherent language files
- Supports various translation formats
- Provides multiple validators
🔥 Installation
composer require --dev move-elevator/composer-translation-validator
📊 Usage
composer validate-translations [<path>]
The command validate-translations
can be used to validate translation files in your project. It will automatically detect the translation files based on the supported formats and run the configured validators.
composer validate-translations [<path>] [-dr|--dry-run] [-f|--format cli|json] [-e|--exclude PATTERN] [-s|--skip VALIDATOR] [-o|--only VALIDATOR] [-v|--verbose]
📝 Documentation
Supported Formats
The plugin supports the following translation file formats (and targets the following frameworks):
Format | Description | Framework | Example files |
---|---|---|---|
XLIFF | Supports source/target translations in xliff language files. | TYPO3 CMS | locallang.xlf , de.locallang.xlf |
Yaml | Supports yaml language files. | Symfony Framework | messages.en.yaml , messages.de.yaml |
Validators
The following validators are available:
Validator | Function | Supports | Throws |
---|---|---|---|
MismatchValidator |
This validator checks for keys that are present in some files but not in others. It helps to identify mismatches in translation keys across different translation files. | XLIFF, Yaml | ERROR |
DuplicateKeysValidator |
This validator checks for duplicate keys in translation files. | XLIFF | ERROR |
DuplicateValuesValidator |
This validator checks for duplicate values in translation files. | XLIFF, Yaml | WARNING |
SchemaValidator |
Validates the XML schema of translation files against the XLIFF standard. See available schemas. | XLIFF | ERROR |
🧑💻 Contributing
Please have a look at CONTRIBUTING.md
.
⭐ License
This project is licensed under GNU General Public License 3.0 (or later).