Skip to content

Latest commit

 

History

History
68 lines (45 loc) · 4.81 KB

README.md

File metadata and controls

68 lines (45 loc) · 4.81 KB
Composer Translation Validator icon

Composer Translation Validator

Coverage CGL Tests Supported PHP Versions

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.

✨ Features

🔥 Installation

Packagist Packagist Downloads

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

Important

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.

🚀 Quick start

composer validate-translations ./translations

The command detects the translation files in the directory, runs the default validators and exits with a non-zero code if it finds errors.

Console output of validate-translations with two mismatch errors

📚 Documentation

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

🧑‍💻 Contributing

Please have a look at CONTRIBUTING.md.

⭐ License

This project is licensed under GNU General Public License 3.0 (or later).