Version

master

Documentation » Translation

« 5. Translate your custom actions in SonataAdmin

6. Global locale switcher

SonataTranslationBundle also provides a nice global locale switcher for your admin.

6.1. Prerequisites

Install the following Sonata dependencies:

6.2. Configuration

Override the standard layout template with the one from the bundle:

# config/packages/sonata_admin.yaml

sonata_admin:
    templates:
        layout: '@SonataTranslation/standard_layout.html.twig'

Configure route:

# config/routes.yaml

sonata_translation:
    resource: '@SonataTranslationBundle/Resources/config/routes.yaml'

Enable locale_switcher:

# config/packages/sonata_translation.yaml

sonata_translation:
    locale_switcher: true

6.3. How it looks

You are done and you probably want to know how this looks like in the admin interface. Well, let’s find out by going to /admin

Sonata Dashboard with locale switcher

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