Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 710
Jessica Avatar asked Jan 11 '14 23:01

Jessica


Video Answer


2 Answers

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.

like image 124
qooplmao Avatar answered Sep 28 '22 00:09

qooplmao


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

rm -rf ./var/cache/*
like image 28
Nicodemuz Avatar answered Sep 28 '22 00:09

Nicodemuz