Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty language switcher on 404 page #114

Open
Mondane opened this issue Jun 9, 2014 · 5 comments
Open

Empty language switcher on 404 page #114

Mondane opened this issue Jun 9, 2014 · 5 comments

Comments

@Mondane
Copy link
Contributor

Mondane commented Jun 9, 2014

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.

@Mondane
Copy link
Contributor Author

Mondane commented Jul 28, 2015

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

@Mondane
Copy link
Contributor Author

Mondane commented Aug 11, 2015

@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 symfony/symfony#15451 (comment) .

Do youi think it's possible to listen to another event in order to have the locales avaiiable in the error pages?

@dbu
Copy link
Collaborator

dbu commented Aug 15, 2015

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.

@Mondane
Copy link
Contributor Author

Mondane commented Aug 18, 2015

Thank you for your look at things. Since my time is limited, I'll wait with developing something until @lunetics has written his thoughts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants