Skip to content
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

[Translator] Collect locale details earlier in the process #31815

Merged
merged 1 commit into from Jun 3, 2019

Conversation

Projects
None yet
3 participants
@pierredup
Copy link
Contributor

commented Jun 3, 2019

Q A
Branch? 4.3
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #31600
License MIT
Doc PR N/A

The LocaleAwareListener class reverts the locale back to the default locale when the request has finished. But the TranslationDataCollector only collects the locale in lateCollect, which only happens when the kernel terminates. This means the locale is reverted back to the default by the time the collector runs.

The PR moves the locale and fallback_locales from lateCollect to collect, so that the information can be captured earlier, before the LocaleAwareListener is run.

@nicolas-grekas

This comment has been minimized.

Copy link
Member

commented Jun 3, 2019

Thank you @pierredup.

@nicolas-grekas nicolas-grekas merged commit 5c394ee into symfony:4.3 Jun 3, 2019

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
fabbot.io Your code looks good.
Details

nicolas-grekas added a commit that referenced this pull request Jun 3, 2019

bug #31815 [Translator] Collect locale details earlier in the process…
… (pierredup)

This PR was merged into the 4.3 branch.

Discussion
----------

[Translator] Collect locale details earlier in the process

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #31600
| License       | MIT
| Doc PR        | N/A

The [LocaleAwareListener](https://github.com/symfony/symfony/blob/4.3/src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php) class reverts the locale back to the default locale when the request has finished. But the `TranslationDataCollector` only collects the locale in `lateCollect`, which only happens when the kernel terminates. This means the locale is reverted back to the default by the time the collector runs.

The PR moves the `locale` and `fallback_locales` from `lateCollect` to `collect`, so that the information can be captured earlier, before the `LocaleAwareListener` is run.

Commits
-------

5c394ee Collect locale details earlier in the process in TranslationDataCollector

@fabpot fabpot referenced this pull request Jun 6, 2019

Merged

Release v4.3.1 #31901

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.