Translations GUI for translating Symfony 2 static strings
Latest commit 6c7885f Jan 13, 2017 @saimaz saimaz committed on GitHub pass the manager fetched from translation repo instead of default one (

* pass the manager fetched from translation repo instead of default one

* temporary removing cli command test cases due complexity

ONGR Translations Bundle

This bundle provides graphical user interface for translations management. It allows to add, edit and remove translations in multiple languages. Translations can be automatically collected from and dumped into your project.

Stable Release Build Status Coverage Quality Score


The documentation of the bundle can be found in Resources/doc/


Follow 5 quick steps to get ready to translate.

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require ongr/translations-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Register bundles in app/AppKernel.php:

class AppKernel extends Kernel
     * {@inheritdoc}
    public function registerBundles()
        return [
            // ...
            new ONGR\ElasticsearchBundle\ONGRElasticsearchBundle(),
            new ONGR\FilterManagerBundle\ONGRFilterManagerBundle(),
            new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
            new ONGR\TranslationsBundle\ONGRTranslationsBundle(),

    // ...

Note: This bundle uses ONGRElasticsearchBundle to store translations. Also ONGRFilterManagerBundle and FOSJsRoutingBundle bundles are used to build user interface.

Step 3: Import Routing

Import API and UI routes:

# app/config/routing.yml
    resource: "@ONGRTranslationsBundle/Resources/config/routing.yml"
    prefix:   /translations

    resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"

Step 4: Configure Elasticsearch Bundle

This bundle provides Translation document. Add this bundle to your ES manager's mapping to associate it:

# app/config/config.yml
    # ...
            # ...
                # ...
                - AppBundle
                - ONGRTranslationsBundle

Once the bundle is added open console and run command to update mapping in Elasticsearch:

$ app/console ongr:es:mapping:update --force

Step 5: Configure the Bundle

This bundle requires minimal configuration to get started:

# app/config/config.yml
    managed_locales: ["en", "de", "lt"]
    repository: 'es.manager.default.translation'

In the example above managed_locales defines locales we are working with and repository defines repository service for Translation document. (Your repository ID may be different depending on what manager name you configured in ongr_elasticsearch section.)

Enable Symfony translations component if you don not have it enabled yet:

    # ...
    translator: { fallbacks: ["%locale%"] }

That's it about setup. Follow next chapter to learn how to work with translations.

For detailed configuration reference check dedicated documentation page.

Translate Your First Message!

Before starting to translate messages, you need to have some. Lets import messages from this bundle. Here is a command ongr:translations:import to do that:

$ app/console ongr:translations:import ONGRTranslationsBundle

Install assets and start web server if it's not running yet:

$ app/console assets:install
$ app/console server:start

Now open in your browser. You should see translations list. You can enter edit mode by clicking on message. Change translation and click "ok" or press Enter to save. Click "x" or press Esc to discard changes.

Read more about import and export of translations in dedicated documentation pages.


This package is licensed under the MIT license. For the full copyright and license information, please view the LICENSE file that was distributed with this source code.