move-elevator / composer-translation-deepl
Auto-fill missing translations using DeepL API
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/move-elevator/composer-translation-deepl
Requires
- php: ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0
- ext-dom: *
- deeplcom/deepl-php: ^1.9
- move-elevator/composer-translation-validator: ^1.3.1
- symfony/console: ^5.0 || ^6.0 || ^7.0 || ^8.0
- symfony/translation: ^5.0 || ^6.0 || ^7.0 || ^8.0
Requires (Dev)
- armin/editorconfig-cli: ^1.8 || ^2.0
- eliashaeussler/rector-config: ^3.0
- ergebnis/composer-normalize: ^2.44
- konradmichalik/php-cs-fixer-preset: ^0.1
- konradmichalik/php-doc-block-header-fixer: ^0.3
- nyholm/psr7: ^1.8
- phpstan/phpstan: ^1.12 || ^2.0
- phpstan/phpstan-phpunit: ^1.4 || ^2.0
- phpstan/phpstan-symfony: ^1.4 || ^2.0
- phpunit/phpunit: ^10.0 || ^11.0
- symfony/http-client: ^5.0 || ^6.0 || ^7.0 || ^8.0
- symfony/var-dumper: ^6.0 || ^7.0 || ^8.0
This package is not auto-updated.
Last update: 2025-12-10 18:36:46 UTC
README
Composer Translation DeepL
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.
✨ Features
- 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.
🔥 Installation
Prerequisites
- PHP 8.1 or higher
- DeepL API key (Get one for free)
Composer
composer require move-elevator/composer-translation-deepl
📊 Usage
Basic Usage
# 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
Advanced Options
# 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 validators
Command Options
vendor/bin/autotranslate <path> [options]
| Option | Short | Description | Default |
|---|---|---|---|
path |
Path to translation files 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 |
Supported File Formats
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 |
🧑💻 Contributing
Please have a look at CONTRIBUTING.md.
⭐ License
This project is licensed under GNU General Public License 3.0 (or later).