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

0.1.0 2025-12-10 12:21 UTC

This package is not auto-updated.

Last update: 2025-12-10 18:36:46 UTC


README

Composer Translation DeepL

Coverage CGL Tests Supported PHP Versions

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, PHP support
  • 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

Composer

Packagist Packagist Downloads

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).