Search code examples
phpsymfonyphp-5.3sonata-adminsonata

Override a translation on the Sonata Admin login screen


On the Sonata Admin login screen the default translation is "Authentication", but i'd like to be able to change this.

Inside \vendor\sonata-project\user-bundle\Resources\views\Admin\Security\login.html.twig there is this line:

<div class="header">{{ 'title_user_authentication'|trans({}, 'SonataUserBundle') }}</div>

The translation for this is found in \vendor\sonata-project\user-bundle\Resources\translations\SonataUserBundle.en.xliff, i.e.:

        <trans-unit id="title_user_authentication">
            <source>title_user_authentication</source>
            <target>Authentication</target>
        </trans-unit>

I am trying to work out how I can change this from within my own bundles. This scenario doesn't appear to be covered in the Sonata documentation, which is very good.


Solution

  • Overriding translations is not specific to Sonata, but to Symfony.

    See the "Overriding any part of a bundle" section of the symfony doc : http://symfony.com/doc/current/cookbook/bundles/override.html#translations