Provides a database storage for translations and GUI for editing them

Installs: 288

Dependents: 0

Stars: 1

Watchers: 2

Type: symfony-bundle

v1.0.0 2014-05-28 13:09 UTC


SensioLabsInsight Build Status Coverage Status Latest Stable Version License

ArgentumTranslationBundle provides a database storage for translations and GUI for editing them.

This bundle supports PHP 5.4+ and Symfony 2.3+.

The bundle combines the power of the following bundles:


Install the bundle with composer:

composer require argentum/translation-bundle:dev-master

Register the bundle in app/AppKernel::registerBundles():

$bundles = array(
    // ...
    new Argentum\TranslationBundle\ArgentumTranslationBundle(),
    // ...


In the parameters.yml you should configure a list of locales:

        - ru
        - uk
        - en

Then in the config.yml you should add the following options:

    locales: %locales%

    locales: %locales%

Make sure you have registered KnpLabs DoctrineBehaviors Listeners in your config.yml:

    - { resource: ../../vendor/knplabs/doctrine-behaviors/config/orm-services.yml }

And finally, create translation tables in your database:

app/console doctrine:schema:update --force

Translation editor

Now you can use GUI for editing the translations.

The bundle will automatically add additional items in the menu of your Sonata Admin.

The list of all domains is located at URL something like (depends on the base location of Sonata Admin in your project): /admin/argentum/translation/translationdomain/list.

Loading order

When merging all translations together translations from files in all bundles will be loaded, and then all translations from the database will be loaded. Thus, translations from the database can override any translation from the translation files in your project.

Proposed workflow

Firstly, when developing your project you should use admin panel to create all necessary domains and add all necessary translations to them.

Secondly, when your bundle is ready, you should export all translations for the bundle domain into the bundle translation files and commit them to VCS.

And finally, when your project is started, you or your client can edit any translation without need to edit project files.


All translations are cached in the cache files and will be loaded from the database only once after clearing the cache.


This bundle allows you to export translations from the database for single domain or all domains in the specified directory for the specified locales using the specified format.

Export all translations to the directory:

app/console translation:export --dir=/path/to/translations

Export translations for domain "messages":

app/console translation:export --dir=/path/to/translations messages

Export translations for domain "messages" and locales "ru" and "uk" in xliff format:

app/console translation:export --dir=/path/to/translations --locales="ru,uk" --format=xlf messages


This bundle allows you to import translations from files into the database.

Import all translations from the specified directory:

app/console translation:import --dir=/path/to/translations

Import translations from the directory only for the domain "messages":

app/console translation:import --dir=/path/to/translations messages

Import translations from the directory only for the domain "messages" and locales "ru" and "uk":

app/console translation:import --dir=/path/to/translations --locales="ru,uk" messages

Import translations from the specified bundles:

app/console translation:import --bundles="SonataAdminBundle, SonataUserBundle"

Import translations from the entire project including all bundles, Form and Validation components, and local application translations:

app/console translation:import