Jessica
Jessica

Reputation: 7005

Symfony FOSUserBundle Translations aren't showing

I enabled the Translator service in my config.yml, cleared cache and installed assets using the command line interface.

My login page still says "security.login.submit". I am using a custom template, which is located in: app/Resources/FOSUserBundle/views/Security/login.html.twig and contains (copied from the FOS provided template):

{{ 'security.login.submit'|trans }}

My config.yml:

framework:
    translator:      { fallback: "%locale%" }
    default_locale:  "%locale%"

parameters.yml:

parameters:
    locale: en

Upvotes: 5

Views: 8507

Answers (2)

Nicodemuz
Nicodemuz

Reputation: 4114

My problem was that the cache was not cleared. To clear your cache:

rm -rf ./var/cache/*

Upvotes: 1

qooplmao
qooplmao

Reputation: 17759

Is this your own copy of the login.html.twig?

If so have you included the trans_default_domain..

{% trans_default_domain 'FOSUserBundle' %}

If not the translator will be looking for translations in the default "messages" file.

Upvotes: 10

Related Questions