Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
derrabus merged 1 commit intosymfony:5.4fromchalasr:lang-neg
Oct 5, 2021

Conversation

@chalasr
Copy link
Member

@chalasrchalasr commentedSep 20, 2021
edited
Loading

QA
Branch?5.4
Bug fix?no
New feature?yes
Deprecations?no
Tickets-
LicenseMIT
Doc PR-

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).

ro0NL, dunglas, raziel057, maxhelias, yceruto, Tetragramat, skigun, and lchrusciel reacted with thumbs up emojiro0NL, alanpoulain, ogizanagi, and lchrusciel reacted with heart emoji
@GregoireHebert
Copy link
Contributor

Thank you for taking over :-)

chalasr reacted with thumbs up emoji

@stof
Copy link
Member

Using theAccept-Language should be opt-in IMO. Otherwise, this might break projects that already set the locale based on other rules (the preferences of a logged-in user for instance).

@chalasrchalasrforce-pushed thelang-neg branch 2 times, most recently fromd491c3b to9f0e400CompareSeptember 20, 2021 14:43
Copy link
Contributor

@OskarStarkOskarStark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Minor

@chalasrchalasrforce-pushed thelang-neg branch 6 times, most recently from53f82a0 to59317c0CompareSeptember 20, 2021 20:01
@chalasrchalasr changed the title[HttpFoundation] Add basic support for language negotiation[HttpKernel] Add basic support for language negotiationSep 20, 2021
@chalasrchalasr added this to the5.4 milestoneSep 20, 2021
@chalasr
Copy link
MemberAuthor

This PR is ready.

Copy link
Member

@derrabusderrabus left a 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!

chalasr reacted with heart emoji
@chalasr
Copy link
MemberAuthor

Thanks for the reviews! All fixed now

@derrabus
Copy link
Member

derrabus commentedOct 5, 2021
edited
Loading

Thank you@GregoireHebert and@chalasr.

chalasr and alanpoulain reacted with hooray emoji

@derrabusderrabus merged commit43f0161 intosymfony:5.4Oct 5, 2021
@chalasrchalasr deleted the lang-neg branchOctober 5, 2021 16:41
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull requestOct 19, 2021
…(hiddewie)This PR was squashed before being merged into the 5.4 branch.Discussion----------[HttpKernel] Add basic support for language negotiationFromsymfony/symfony#43108Fixes#15891I 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
This was referencedNov 5, 2021
nicolas-grekas added a commit that referenced this pull requestDec 1, 2021
…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 :#43108Commits-------6074226 ResponseListener needs only 2 parameters
fabpot added a commit that referenced this pull requestDec 1, 2021
…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@chalasrCommits-------afab34d [HttpKernel] fix sending Vary: Accept-Language when appropriate
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof left review comments

@OskarStarkOskarStarkOskarStark left review comments

@dunglasdunglasdunglas approved these changes

@derrabusderrabusderrabus approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

7 participants

@chalasr@GregoireHebert@stof@derrabus@dunglas@OskarStark@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp