-1

I'm customizing my error pages and I was wandering if it is possible to get the language of the country user directly in my template, without the controller.

Kévin Duguay
  • 761
  • 3
  • 12
  • 29

1 Answers1

0

You can use :

{{ app.request.locale }}

Edit

Ah i didn't understood the question but this is what you are looking for :

 $request->getPreferredLanguage($anArrayOfYourSupportedLanguages);

Then pass it to your twig. fabpot answer :

https://groups.google.com/forum/#!topic/symfony-devs/-2AwAQhlLLQ

Nawfal Serrar
  • 2,213
  • 1
  • 14
  • 22