-
Notifications
You must be signed in to change notification settings - Fork 76
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
Locale switch and forwards #84
Comments
I can confirm this. I use the
I just want to point out, that this will probably be an bigger issue, when ESI comes into play. The only solution, that comes into my mind, is to provide an own controller-action, that accepts all required parameters (optionally) and renders the template.
|
Any idea how to best fix this? |
@lunetics Uh, too fast. I updated my comment. Doesn't mean, that this is the best, or only solution, but feels like the simplest for now. Up for discussion. |
@kingcrunch there was a point where i intentionally removed the locale from the request attributes, let me look in the older issues :) |
Any news an this issue? I can also confirm this using SF 2.3. A regular show action works as expected, only if I forward an action to another method the locales-array remains empty. It is set, I can even ladybug-dump the locales-array, it shows an empty array. Config: lunetics_locale:
switcher:
show_current_locale: true
allowed_locales:
- de
- en
- it
- fr
guessing_order:
- query
- router
- session
- cookie
cookie:
set_on_change: true So while return $this->redirect($this->generateUrl('certificate.show', ['id' => $certificate->getId()])); works as it sould (it displays all four languages), the following action leaves the selector empty: return $this->forward('WebBundle:EntryCertificate:finalized', ['id' => $certificate->getId()]); Both of them share the same base.html which calls the locale_switcher: {{ locale_switcher(null, null, 'WebBundle::localeSwitcherDropdown.html.twig') }} |
Still a problem in 2.5 |
If a forward happens in symfony (2.3 but i think 2.1 as well) the
_route
request attribute becomes empty.That means in some cases (when useController is off which is the default and on does not seem to work right now anyway) after a forward, TargetInformationBuilder will catch a
RouteNotFoundException
and the locales array for the locale switcher will be empty.I think the bundle should be able to at least generate a fallback url in this case. Maybe use the
redirect_to_route
config option which in this case seems to be unused?Or do you suggest anything else to try out?
The text was updated successfully, but these errors were encountered: