Installation
Requirements
- PHP 8.2 or higher
- Composer 2.0 or higher
Install via Composer
Add the plugin as a development dependency:
composer require --dev move-elevator/composer-translation-validatorThe plugin will be automatically registered with Composer and the validate-translations command becomes available.
This is the recommended way to use the tool inside a Composer/PHP project.
Standalone PHAR
For CI pipelines or non-Composer projects, a standalone PHAR is available. It runs as its own process with all dependencies bundled, so it never conflicts with your project's dependencies.
Download the latest PHAR (and its checksum) from the GitHub releases page:
curl -L -o composer-translation-validator.phar \
https://github.com/move-elevator/composer-translation-validator/releases/latest/download/composer-translation-validator.phar
curl -L -o composer-translation-validator.phar.sha256 \
https://github.com/move-elevator/composer-translation-validator/releases/latest/download/composer-translation-validator.phar.sha256
# Verify the download
sha256sum -c composer-translation-validator.phar.sha256
chmod +x composer-translation-validator.pharRun it directly against your translation folders:
./composer-translation-validator.phar ./translations --recursiveThe PHAR accepts the same arguments and options as the validate-translations command.
GitHub Action
For GitHub Actions, use the bundled composite action instead of downloading the PHAR manually:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
- name: Validate translations
uses: move-elevator/composer-translation-validator@<release-tag>
with:
args: ./translations --recursiveInputs:
| Input | Description | Default |
|---|---|---|
version | Release tag to use (e.g. 1.6.0). Defaults to the latest release. | latest |
args | Whitespace-separated arguments passed to the PHAR, e.g. paths and options. | . |
working-directory | Directory the PHAR is executed in. | . |
The action downloads the PHAR for the pinned (or latest) release, verifies its checksum, and runs it. It does not set up PHP itself, and the default PHP version on GitHub-hosted runners can be older than what the PHAR requires (see Requirements), so set up a matching PHP version beforehand with shivammathur/setup-php as shown above. Replace <release-tag> with a release that contains action.yml. Because args is split on whitespace and not glob-expanded, paths containing spaces are not supported.
GitLab CI Template
For GitLab CI, include the hosted template and extend its job:
include:
- remote: 'https://raw.githubusercontent.com/move-elevator/composer-translation-validator/<release-tag>/.gitlab/ci/translation-validator.yml'
validate-translations:
extends: .translation-validator
variables:
TRANSLATION_VALIDATOR_ARGS: "./translations --recursive"The TRANSLATION_VALIDATOR_VERSION variable pins a release tag (defaults to latest), the same way the GitHub Action's version input does. Pin the include to the same <release-tag> instead of main, and the same whitespace-splitting rule applies to TRANSLATION_VALIDATOR_ARGS.
Verify Installation
Check that the command is available:
composer validate-translations --helpYou should see the command help output with all available options.
Updating
Update to the latest version:
composer update move-elevator/composer-translation-validatorUninstalling
Remove the plugin:
composer remove move-elevator/composer-translation-validator