lordjancso / translation-bundle
Translation bundle for Symfony to manage your translations.
Package info
github.com/lordjancso/TranslationBundle
Type:symfony-bundle
pkg:composer/lordjancso/translation-bundle
Requires
- php: ^8.1
- doctrine/doctrine-bundle: ^2.14 || ^3.0
- doctrine/orm: ^2.14 || ^3.0
- nikic/php-parser: ^5.0
- symfony/config: ^6.4 || ^7.4 || ^8.0
- symfony/console: ^6.4 || ^7.4 || ^8.0
- symfony/dependency-injection: ^6.4 || ^7.4 || ^8.0
- symfony/filesystem: ^6.4 || ^7.4 || ^8.0
- symfony/finder: ^6.4 || ^7.4 || ^8.0
- symfony/translation: ^6.4 || ^7.4 || ^8.0
- symfony/yaml: ^6.4 || ^7.4 || ^8.0
Requires (Dev)
- symfony/phpunit-bridge: ^6.4 || ^7.4 || ^8.0
Suggests
- twig/twig: Required for the translation stats UI controller
This package is auto-updated.
Last update: 2026-03-26 13:12:44 UTC
README
Translation bundle for Symfony to manage your translations in the database.
Requirements
- PHP 8.2+
- Symfony 6.4 / 7.4 / 8.0
- Doctrine ORM
Installation
composer require lordjancso/translation-bundle
Configuration
# config/packages/lordjancso_translation.yaml lordjancso_translation: managed_locales: ['en', 'fr', 'de'] # required extract: translations_dir: 'translations' # default: 'translations' exclude_domains: [] # default: []
Optionally you can add a route to check your translation progress.
# config/routes/dev/lordjancso_translation.yaml lordjancso_translation: resource: "@LordjancsoTranslationBundle/Resources/config/routes.xml" prefix: /lordjancso-translation
Create the database tables with Doctrine:
php bin/console doctrine:schema:update --force
Usage
Extract
Extract translation keys from your source code into YAML files.
php bin/console lordjancso:extract-translations hu
Export
Export translations from the database to YAML files.
php bin/console lordjancso:export-translations
Import
Import YAML translation files into the database.
php bin/console lordjancso:import-translations
Translation stats UI
If you added the route, visit /lordjancso-translation to see a translation coverage overview per domain and locale.
Testing
./vendor/bin/simple-phpunit
Limitations
- Only supports Doctrine ORM with MySQL