I can't figure out why when I traduce with Symfony it returns me the key, not the message traduced. I am using symfony 2.7 and this is my configuration: I have enable the translator in my config.yml file:
translator: { fallback: ["%locale%"] }
This is my function inside the controller:
/**
* @Route("/consult", name="showConsult")
* @Template("AppBundle:Admin:consult.html.twig")
*/
public function showConsult(Request $request)
{
$request->setLocale('fr');
var_dump($this->get('translator')->trans("login.version"));
return array();
}
And this is my translations file in app/Resources/translations
#messages.fr.yml
login.version: Version APP
I have tried also with twig functions:
{{"login.version"|trans}}
{%trans%}'login.version'{%endtrans%}
EDIT: I have also clear chache EDIT2: Ok I have discover that $request->setLocale() is not working. If I force the locale in the config.yml it works. Do you know how I can fix this? I have read this but they did not work for me. I am working with Windows 10 The output is always the key. I get "login.version" instead of "Version APP" Can anybody help me? Thanks in advance