-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[FrameworkBundle][Routing] Update the enabled_locales
description
#19777
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
[FrameworkBundle][Routing] Update the enabled_locales
description
#19777
Conversation
If some user makes requests with a locale not included in this option, the | ||
application won't display any error because Symfony will display contents using | ||
the fallback locale. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is no special locale parameter in request, this case is applied right ?
I think we should document it. I'm not sure what IS "fallback local", is it the default locale ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand your comment ... according to the code, if you use enabled_locales
, the _locale
will be set unconditionally:
added as a requirement of the :ref:`special _locale parameter <routing-locale-parameter>`. | ||
For example, if you define this value as ``['ar', 'he', 'ja', 'zh']``, the | ||
``_locale`` routing parameter will have an ``ar|he|ja|zh`` requirement. If some | ||
user makes requests with a locale not included in this option, they'll see an error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we document what « error » ? 404 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's a 404 error. I added that while merging. Thanks!
enabled_locales
description
While working on symfony/demo#1511 I found this feature, which works since Symfony 5.4. See:
https://github.com/symfony/symfony/blob/184597db05288c68c9eb11dff55239768268f646/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php#L1083-L1086