php - symfony twig translation not working after update -


i upgraded project 2.5.x 2.8.1 , twig not using correct translations anymore.

in twig template have this: {% trans %}something.abc{% endtrans %}

my config.yml looks this:

... framework:     translator:      ~ ... templating:     engines: ['twig'] default_locale:  en_us 

in controller action:

$request->setlocale('nl_be'); 

the page showing en_us translation , never else.

did change?

it because translatorlistener (which added in 2.6) sets locale before action called in controller. use $this->get('translator')->setlocale('nl_be'); instead, if want change locale in controller.


Comments