php - Localized error pages in Symfony2


We're creating an application in Symfony2 that is localized to Dutch and English. Now I know how to customize the Symfony error pages, but can't find how to translate the errorpages anywhere. I've tried to use thetrans filter in the error templates, but it doesn't seem to use my translations file.

Also I can't find any option to make multiple error pages, one for each language, and localize them.

Does anyone know if this is possible at all, I can imagine that it's hard to implement because the error could be thrown due translation errors. But if it is I would love a hint or link on how to do this correctly.




You can try make use of global variables (app.request.locale or app.session.locale before symfony 2.1) which are available in templates.

{% if app.request.locale == 'nl' %}
    some error message
{% else %}
    error message in other language
{% endif %}

People are also looking for solutions to the problem: PHP form validation where value is not null


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.