Missing keys, duplicate keys, mismatched placeholders and broken HTML in translation files surface at runtime, as raw key names on the page or as formatting errors. This tool finds them before they ship: it groups the language files of a project, compares them and reports the differences.
It runs as a Composer plugin (composer validate-translations) and as a standalone PHAR with a GitHub Action and a GitLab CI template. XLIFF, YAML, JSON and PHP files are supported.
- Auto-detection: pairs language files by suffix, prefix or directory without configuration
- Formats: XLIFF, YAML, JSON and PHP
- Validators: mismatches, duplicates, placeholders, HTML tags, schema and more
- Output: CLI, JSON and GitHub annotation formats
- Configuration: config file in PHP, JSON or YAML
composer require --dev move-elevator/composer-translation-validatorImportant
The plugin needs PHP 8.2 or higher and Composer 2.2 or higher. The standalone PHAR, the GitHub Action and the GitLab CI template need PHP 8.4.1 or higher, see the installation guide for details.
composer validate-translations ./translationsThe command detects the translation files in the directory, runs the default validators and exits with a non-zero code if it finds errors.
Full documentation: move-elevator.github.io/composer-translation-validator
| Topic | What's inside |
|---|---|
| Getting started | What the tool checks, installation paths (Composer, PHAR, GitHub Action, GitLab CI), first run |
| Configuration | Config file formats, every option, per-validator settings |
| CLI reference | Arguments, options, output formats and exit codes |
| Validators | What each validator checks, with examples |
| File formats | Supported formats and their parsing rules |
| File detection | How language files are grouped into sets |
| Programmatic usage | Calling the validator from PHP code |
Please have a look at CONTRIBUTING.md.
This project is licensed under GNU General Public License 3.0 (or later).
