move-elevator/composer-translation-validator

A Composer plugin that validates translations files in your project regarding mismatches between language source and target files.

0.3.0 2025-06-28 14:53 UTC

README

Composer Translation Validator

Coverage CGL Tests Supported PHP Versions

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

Packagist Packagist Downloads

composer require --dev move-elevator/composer-translation-validator

📊 Usage

composer validate-translations [<path>]

console.png

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).