Empty language switcher on 404 page
I have a custom 404 page which also shows the language switcher. On this page there are no entries in the switcher, is there a setting I'm missing? I would like to be able to translate this page too.
Any progress on this one? The languages are there when testing the page in symfony 2.6 and higher using this in routing_dev.yml:
_errors:
resource: "@TwigBundle/Resources/config/routing/errors.xml"
prefix: /_error
and this URL /app_dev.php/_error/403
Maybe this helps to get a fix:
- http://stackoverflow.com/questions/19177916/miss-locale-in-error-page-symfony-2
- http://stackoverflow.com/questions/18172469/error-pages-symfony2-with-locale
- https://gist.github.com/euskadi31/684deb09b5da66530eff
@dbu, I discussed this issue with the symfony developers and it appears to be caused by the following:
It's not, the bundle you are using explicitly sets the listener priority to have it triggered after the router listener (https://github.com/lunetics/LocaleBundle/blob/master/EventListener/LocaleListener.php#L185) so it's a problem in the bundle.
See https://github.com/symfony/symfony/issues/15451#issuecomment-127905608 .
Do youi think it's possible to listen to another event in order to have the locales avaiiable in the error pages?
hm, not sure if that is possible. if something relies on the work the routing did, things would fail miserably. but it actually could be that it can indeed work. the 404 happens during the routing, so everything we do after that is too late.
a first step would be you create a branch of LocaleBundle where you change the priority to a higher value so it happens before routing and see if that works.
what does seem wrong is when there are no languages in the switcher. that would mean some of the bootstrap is wrong. what i see from your links is that the current locale might not be properly set. changing the locale on a 404 page seems not that important to me but having the right locale for the error page would be rather important.
i hope you can find something or @lunetics can help us here. you could try to build a functional test with a 404 page to test the interaction in a way you can also share with us.
Thank you for your look at things. Since my time is limited, I'll wait with developing something until @lunetics has written his thoughts.