-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Routing] Default locale in routes #9981
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
Comments
That's because optional parameters can only be defined at the end of the path. See #5424. |
Documentation: http://symfony.com/doc/current/book/routing.html#required-and-optional-placeholders When just reading the docs, I wouldn't think, that optional parameters only work at the end of a URL. So, maybe this is a docs issue? |
Well, then doc is incorrect: |
it is indeed incorrect then, let's close this and i have opened symfony/symfony-docs#3450 |
👍 |
@MAXakaWIZARD Can you explain why the route
IMHO it's weird to have optional placeholder on the path. The doc say:
EDIT after #9981 (comment):
|
@alquerci It should match, another thing is that you should redirect from /en/contact to /contact, but that's different problem |
@MAXakaWIZARD Ho, sorry I don't want to say, the route It's ok that the route
|
@alquerci I think if en is default locale, then you anyway should redirect from /en/contact to /contact to avoid content duplication |
@MAXakaWIZARD I said really wrong things, sorry for that. I just wanted to clarify that the doc does not say that the route There may be another way to do the same thing, like @jakzal said #9981 (comment). |
This shouldn't be a problem since you can use the RedirectController of the FrameworkBundle in your routing config. |
Closing as the actual feature is part of #5424. And the documentation has been updated to clarify the current behavior and confusion that it's not possible yet. |
Maybe I solved this in a reasonably simple way:
Curious about the judgement of the critics ... First amendment ... |
Consider example from docs
As docs say it should apply default locale for path /contact
But it doesn't:
However, it works for route (optional placeholder is last in path):
This was checked on Symfony Standard 2.4.1 and 2.4.0
The text was updated successfully, but these errors were encountered: