Kévin Duguay
Kévin Duguay

Reputation: 761

Symfony how to internationalize custom error pages

I'm creating custom error pages for the 404 and 500 error in my Symfony project. I would like to know how to internationalize those pages.

What I mena by thta is that I already know how to use {% trans %} in my twig and how to create the file whit the translated texte. What I

Usally, my urls look like that: kevinduguay.ca/en/..... but in the case of an error page, /en might not be there, but I still need to find in what language I should siplay the page. Maybe the language of the country?

Hope you can help me.

Upvotes: 0

Views: 312

Answers (1)

ghanbari
ghanbari

Reputation: 1629

by following this cookbook, you can find current local in error page by: $request->getLocal();

Although you dont nedd to this, trans() method detect current local

Upvotes: 1

Related Questions