-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] Add basic support for language negotiation #43108
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
Conversation
Thank you for taking over :-) |
Using the |
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Show resolved
Hide resolved
d491c3b
to
9f0e400
Compare
75e8338
to
456df0f
Compare
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.
Minor
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/HttpKernel/EventListener/ResponseListener.php
Outdated
Show resolved
Hide resolved
53f82a0
to
59317c0
Compare
This PR is ready. |
src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php
Outdated
Show resolved
Hide resolved
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.
Some nit-picking. 🙂
Looks good, thank you!
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Outdated
Show resolved
Hide resolved
Thanks for the reviews! All fixed now |
Thank you @GregoireHebert and @chalasr. |
…(hiddewie) This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [HttpKernel] Add basic support for language negotiation From symfony/symfony#43108 Fixes #15891 I moved the documentation for the deprecated option with a deprecation notice at the old place. The new options `set_content_language_from_locale` and `set_locale_from_accept_language` have been documented. Commits ------- c41db2f [HttpKernel] Add basic support for language negotiation
…rs (maxhelias) This PR was merged into the 5.4 branch. Discussion ---------- [FrameworkBundle] ResponseListener needs only 2 parameters | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | - | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Introduced in 5.4 with : #43108 Commits ------- 6074226 ResponseListener needs only 2 parameters
…riate (nicolas-grekas) This PR was merged into the 5.4 branch. Discussion ---------- [HttpKernel] fix sending Vary: Accept-Language when appropriate | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - That's something I figured our while reviewing #44386 and that we missed in #43108: the `Vary` header should be sent when we use `Accept-Language`, not when we send `Content-Language`. /cc @chalasr Commits ------- afab34d [HttpKernel] fix sending Vary: Accept-Language when appropriate
Continuation of #36507. Thanks @GregoireHebert!
This PR adds two options to the framework configuration:
set_locale_from_accept_language
: Makes theRequest
' locale automatically set based on theAccept-Language
header (restricted by a newframework.enabled_locales
config option which replacesframework.translator.enabled_locales
).The explicit
_locale
request attribute always wins over theAccept-Language
header when it's set.set_content_language_from_locale
: Sets theContent-Language
Response header based on theRequest
' locale.This is going to be useful for API Platform and related (e.g. Sylius/Sylius#11412).