-
-
Notifications
You must be signed in to change notification settings - Fork 930
WIP: Use Accept-Language to select the locale #3826
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
WIP: Use Accept-Language to select the locale #3826
Conversation
GregoireHebert
commented
Nov 12, 2020
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Tickets | ~ |
License | MIT |
Doc PR | ~ |
use Symfony\Component\Routing\RequestContextAwareInterface; | ||
|
||
/** | ||
* Choose the locale to use according to the Accept-Language header |
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.
* Choose the locale to use according to the Accept-Language header | |
* Chooses the locale to use according to the Accept-Language header |
private $router; | ||
private $resourceMetadataFactory; | ||
|
||
public function __construct(ResourceMetadataFactoryInterface $resourceMetadataFactory, RequestContextAwareInterface $router = null, array $defaultEnabledLocales = []) |
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.
In my opinion, this listener belongs in Symfony. /cc @nicolas-grekas
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.
this has been rejected in symfony/symfony#36507, isn't it?
(the arguments against it would apply to this PR btw ;) )
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 the arguments against. It's opt-in (so it cannot be a security vulnerability, the linked one is not related), it's a core feature of HTTP and it's very useful for APIs.
Fixed in symfony/symfony#43108 |
We should add the correct default configuration in API Platform then! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |