Autofill missing translations using the DeepL API.
A lightweight Composer package that automatically completes missing translations in your project translation files.
Warning
This package is in early development stage and may change significantly in the future. I am working steadily to release a stable version as soon as possible.
- Automatic Translation - Uses DeepL API to fill missing translation keys
- Batch Processing - Translates up to 50 keys per API request for optimal performance
- Multiple Formats -
XLIFF,YAML,JSON,PHPsupport - TYPO3 Compatible - Works with TYPO3 XLIFF format
- Symfony/Laravel Ready - Supports standard translation file structures
- Dry-Run Mode - Preview changes before applying
- Progress Tracking - Visual progress bar and detailed statistics
- API Usage Display - Shows your DeepL character usage
- XLIFF Marking - State marking for auto-translated content
Note
This package is a feature addon for finding missing translations with the composer-translation-validator plugin.
- PHP 8.1 or higher
- DeepL API key (Get one for free)
composer require move-elevator/composer-translation-deepl# Set your DeepL API key
export DEEPL_API_KEY=your-api-key-here
# Translate to German
vendor/bin/autotranslate translations/ -t de
# Or via Composer
composer autotranslate translations/ -- -t de
# Or direct PHP execution
php bin/autotranslate -t de# Translate a single file
vendor/bin/autotranslate translations/messages.en.xlf -t de
# Translate to multiple languages
vendor/bin/autotranslate translations/ -t de -t fr -t es
# Custom source locale
vendor/bin/autotranslate -s en-US -t de-DE
# Specific format
vendor/bin/autotranslate -t de -f yaml
# Custom domain
vendor/bin/autotranslate -t de --domain validatorsvendor/bin/autotranslate <path> [options]| Option | Short | Description | Default |
|---|---|---|---|
path |
Path to translation file or directory | translations/ |
|
--source-locale |
-s |
Source locale | en |
--target-locales |
-t |
Target locales (multiple) | required |
--api-key |
-k |
DeepL API key | DEEPL_API_KEY env |
--format |
-f |
File format (xliff, yaml, json, php) | xliff |
--domain |
- | Translation domain | messages |
--dry-run |
-d |
Simulate without writing | false |
--force |
- | Overwrite without confirmation | false |
--no-mark-auto-translated |
- | Disable XLIFF state marking | false (marking enabled) |
--verbose |
-v |
Detailed output | false |
--quiet |
-q |
Only errors | false |
Translation files are detected and processed based on their format:
| Format | Frameworks | Example files |
|---|---|---|
| XLIFF | TYPO3 CMS, Symfony | locallang.xlf, de.locallang.xlf, messages.de.xlf |
| YAML | Symfony | messages.en.yaml, messages.de.yaml |
| JSON | Laravel, Symfony | messages.en.json, messages.de.json |
| PHP | Laravel | en/messages.php, messages.en.php |
Please have a look at CONTRIBUTING.md.
This project is licensed under GNU General Public License 3.0 (or later).