Documentation » Translation

2. Advanced Configuration »

« Translation Bundle

1. Installation

1.1. Download the Bundle

composer require sonata-project/translation-bundle

1.2. Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in bundles.php file of your project:

// config/bundles.php

return [
    // ...
    Sonata\TranslationBundle\SonataTranslationBundle::class => ['all' => true],

1.3. Configure the Bundle

To use the TranslationBundle, add the following lines to your application configuration file:

  • YAML
    # config/packages/sonata_translation.yaml
        locales: [en, fr, it, nl, es]
        default_locale: en
        # here enable the types you need
            enabled: true
            enabled: true
        #    enabled: true
Key Description
locales The list of your frontend locales in which your models will be translatable.
default_locale The locale, loaded in your forms by default.


If you are using the SonatAdminBundle with the SonataDoctrineORMAdminBundle, you should read the ORM chapter. If you are using SonataDoctrinePhpcrAdminBundle, you should read the PHPCR chapter.

1.4. Import the Styles

Install SonataTranslationBundle web assets under your public web directory:

bin/console assets:install

Add CSS file to your SonataAdminBundle config:

# config/packages/sonata_admin.yaml

            - bundles/sonatatranslation/css/sonata-translation.css

Now, you’re good to go!

Found a typo? Something is wrong in this documentation? Just fork and edit it!