5. Global locale switcher

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

5.1. Prerequisites

Install the following Sonata dependencies:

5.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

5.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