move-elevator / composer-translation-validator
A Composer plugin that validates translations files in your project regarding mismatches between language source and target files.
Installs: 59
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
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-06-28 14:53:41 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] [-e|--exclude PATTERN] [-v|--verbose]
📝 Documentation
Supported Formats
The plugin supports the following translation file formats:
Format | File endings | Description | Example files |
---|---|---|---|
XLIFF | *.xlf , *.xliff |
Supports source/target translations in xliff language files. Used e.g. within TYPO3 CMS. | locallang.xlf , de.locallang.xlf |
Yaml | *.yml , *.yaml |
Supports yaml language files. Used e.g. within Symfony Framework. | messages.en.yaml , messages.de.yaml |
Validators
The following validators are available:
Validator | Function | Supports |
---|---|---|
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 |
DuplicatesValidator |
This validator checks for duplicate keys in translation files. | XLIFF |
SchemaValidator |
Validates the XML schema of translation files against the XLIFF standard. | XLIFF |
🧑💻 Contributing
Please have a look at CONTRIBUTING.md
.
⭐ License
This project is licensed under GNU General Public License 3.0 (or later).