8000 [TwigBridge] suggest Translation Component when TranslationExtension is used by nicolas-grekas · Pull Request #31761 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[TwigBridge] suggest Translation Component when TranslationExtension is used #31761

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

Merged
merged 1 commit into from
Jun 1, 2019

Conversation

nicolas-grekas
Copy link
Member
Q A
Branch? 4.3
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #31754
License MIT
Doc PR -

@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
if (null === $this->translator) {
if (!interface_exists(TranslatorInterface::class)) {
throw new \LogicException(sprintf('You cannot use the "%s" if the Translation Contracts are not available. Try running "composer require symfony/translation-contracts".', __CLASS__));
Copy link
Member

Choose a reason for hiding this comment

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

What about recommending symfony/translator instead? If there are some usage of the Translation extension, it means that people want to use translation. So, they need the concrete implementation, not just the contracts.

Copy link
Member Author

Choose a reason for hiding this comment

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

Why not. What's the use case for using the extension without providing it a translator?

Copy link
Member

Choose a reason for hiding this comment

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

The only use case is for third-party bundles using translations, but that must be compatible with projects not using translations. But anyway, the main usage is when people wants to use translations, in which case, we need to recommend the implementation.

Copy link
Member Author

Choose a reason for hiding this comment

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

ACK, updated

@nicolas-grekas nicolas-grekas changed the title [TwigBridge] suggest Translation Contracts when TranslationExtension is used [TwigBridge] suggest Translation Component when TranslationExtension is used Jun 1, 2019
@fabpot
Copy link
Member
fabpot commented Jun 1, 2019

Thank you @nicolas-grekas.

@fabpot fabpot merged commit d4a9e7e into symfony:4.3 Jun 1, 2019
fabpot added a commit that referenced this pull request Jun 1, 2019
…nExtension is used (nicolas-grekas)

This PR was merged into the 4.3 branch.

Discussion
----------

[TwigBridge] suggest Translation Component when TranslationExtension is used

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

Commits
-------

d4a9e7e [TwigBridge] suggest Translation Component when TranslationExtension is used
@nicolas-grekas nicolas-grekas deleted the twig-trans branch June 5, 2019 14:41
@fabpot fabpot mentioned this pull request Jun 6, 2019
mhujer added a commit to mhujer/BreadcrumbsBundle that referenced this pull request Nov 23, 2019
symfony/twig-bridge 4.3.1 is needed because of symfony/symfony#31761
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0