https://github.com/move-elevator/composer-translation-validator
🌐 Composer plugin that validates translation files in your project.
https://github.com/move-elevator/composer-translation-validator
translation translation-validation xliff-validation yaml-validator
Last synced: 4 months ago
JSON representation
🌐 Composer plugin that validates translation files in your project.
- Host: GitHub
- URL: https://github.com/move-elevator/composer-translation-validator
- Owner: move-elevator
- License: gpl-3.0
- Created: 2025-05-26T08:56:15.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-07-28T07:53:24.000Z (4 months ago)
- Last Synced: 2025-07-28T08:38:23.191Z (4 months ago)
- Topics: translation, translation-validation, xliff-validation, yaml-validator
- Language: PHP
- Homepage: http://move-elevator.de/
- Size: 1000 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
- awesome-composer - Composer Translation Validator - Validates translation files in your project, supports several file formats (regarding different frameworks) and provides useful validators for comparison, consistency and syntax checks. (Plugins / Support)
README
# Composer Translation Validator
[](https://coveralls.io/github/move-elevator/composer-translation-validator)
[](https://github.com/move-elevator/composer-translation-validator/actions/workflows/cgl.yml)
[](https://github.com/move-elevator/composer-translation-validator/actions/workflows/tests.yml)
[](https://packagist.org/packages/move-elevator/composer-translation-validator)
A Composer plugin that validates translation files in your project.
Provides a command `validate-translations` to check for translations mismatches, duplicates, schema validation and more.
Supports XLIFF, YAML, JSON and PHP translation files.
## ✨ Features
* Autodetect coherent language files
* Supports various [translation file formats](#supported-file-formats)
* Provides multiple [validators](#translation-validators)
* Configurable via separate [configuration files](docs/config-file.md)
## 🔥 Installation
[](https://packagist.org/packages/move-elevator/composer-translation-validator)
[](https://packagist.org/packages/move-elevator/composer-translation-validator)
```bash
composer require --dev move-elevator/composer-translation-validator
```
## 📊 Usage
Validate your translation files by running the command:
```bash
composer validate-translations ./translations
```

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](#supported-file-formats) and run the configured [validators]((#translation-validators)). See the [console command documentation](docs/console-command.md) for more details.
## 📝 Documentation
### Supported File Formats
Translations will be detected and grouped by the following file formats (regarding the associated frameworks):
| Format | Frameworks | Example files |
|--------|------------|----------------------------------------|
| [XLIFF](docs/file-detector.md#xliff-xml-localization-interchange-file-format) | TYPO3 CMS | `locallang.xlf`, `de.locallang.xlf` |
| [YAML](docs/file-detector.md#yaml-yaml-aint-markup-language) | Symfony | `messages.en.yaml`, `messages.de.yaml` |
| [JSON](docs/file-detector.md#json-javascript-object-notation) | Laravel, Symfony | `messages.en.json`, `messages.de.json` |
| [PHP](docs/file-detector.md#php-arrays) | Laravel, Symfony | `en/messages.php`, `messages.en.php` |
See detailed [file format and file detection documentation](docs/file-detector.md) with examples.
### Translation Validators
The following translation validators are available (and enabled by default):
| Validator | Description |
|-----------|-------------|
| [DuplicateKeysValidator](docs/validators.md#duplicatekeysvalidator) | Catches duplicate keys within files |
| [DuplicateValuesValidator](docs/validators.md#duplicatevaluesvalidator) | Finds identical translation values |
| [EmptyValuesValidator](docs/validators.md#emptyvaluesvalidator) | Detects empty or whitespace-only values |
| [EncodingValidator](docs/validators.md#encodingvalidator) | Validates UTF-8 encoding and Unicode issues |
| [HtmlTagValidator](docs/validators.md#htmltagvalidator) | Ensures HTML tag consistency across languages |
| [KeyNamingConventionValidator](docs/validators.md#keynamingconventionvalidator) | Enforces key naming patterns (requires config) |
| [MismatchValidator](docs/validators.md#mismatchvalidator) | Finds missing translations between files |
| [PlaceholderConsistencyValidator](docs/validators.md#placeholderconsistencyvalidator) | Validates placeholder patterns |
| [XliffSchemaValidator](docs/validators.md#xliffschemavalidator) | Validates XLIFF against XML schemas |
View detailed [validator documentation](docs/validators.md) with examples.
## 🧑💻 Contributing
Please have a look at [`CONTRIBUTING.md`](CONTRIBUTING.md).
## ⭐ License
This project is licensed under [GNU General Public License 3.0 (or later)](LICENSE).