Skip to content

Composer Translation ValidatorValidate your translation files

A Composer plugin that validates XLIFF, YAML, JSON and PHP translation files for mismatches, duplicates, schema issues and more.

Composer Translation Validator

Quick Start

Install the plugin via Composer:

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

Validate your translation files:

bash
composer validate-translations ./translations

Console Output

Supported Formats

FormatExtensionsFrameworks
XLIFF.xlf, .xliffTYPO3 CMS
YAML.yaml, .ymlSymfony
JSON.jsonLaravel, Symfony
PHP.phpLaravel, Symfony

Available Validators

ValidatorTypeDescription
MismatchValidatorERRORFinds missing translations between language files
DuplicateKeysValidatorERRORCatches duplicate keys within files
XliffSchemaValidatorERRORValidates XLIFF against XML schemas
DuplicateValuesValidatorWARNINGFinds identical translation values (opt-in)
EmptyValuesValidatorWARNINGDetects empty or whitespace-only values
PlaceholderConsistencyValidatorWARNINGValidates placeholder patterns
HtmlTagValidatorWARNINGEnsures HTML tag consistency across languages
EncodingValidatorWARNINGValidates UTF-8 encoding and Unicode issues
KeyCountValidatorWARNINGWarns when files exceed key threshold
KeyDepthValidatorWARNINGWarns about excessive nesting depth
KeyNamingConventionValidatorWARNINGEnforces key naming patterns

See the Validators Reference for detailed documentation.

Released under the GPL-3.0 License.