Skip to content

[Translation] Translatable parameters #44672

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
Dec 17, 2021

Conversation

sylfabre
Copy link
Contributor

Q A
Branch? 6.1
Bug fix? no
New feature? yes
Deprecations? no
Tickets N/A
License MIT
Doc PR TBD

✅ The TwigExtension now supports messages implementing TranslatableInterface (https://symfony.com/blog/new-in-symfony-5-2-translatable-objects).
✅ Thanks to #41858, TranslatableMessage now supports recursive TranslatableInterface as params.

❌ But using TranslatableInterface as params with regular messages is not supported yet.

💡 This PR addresses this issue and makes it possible to create dedicated TranslatableInterface implementations like the one from #41136

Note: I would like also to add TranslatableInterface to the trans(?string $id) signature method like with the one from the TwigExtension but I don't know how to do it without breaking BC. Any advice is welcome!

@carsonbot carsonbot added this to the 6.1 milestone Dec 16, 2021
@sylfabre sylfabre force-pushed the translatable_parameter branch 3 times, most recently from 9f42cc7 to 7a0b2fc Compare December 17, 2021 08:50
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

LGTM after some minor comments are addressed.

I would like also to add TranslatableInterface to the trans(?string $id) signature method like with the one from the TwigExtension but I don't know how to do it without breaking BC. Any advice is welcome!

I can't think of any appropriate BC layer (renaming the method is not an appropriate way :) )
I think it's fine not supporting this personnaly.

@sylfabre sylfabre force-pushed the translatable_parameter branch from 16b6723 to 5beaee8 Compare December 17, 2021 11:09
@sylfabre
Copy link
Contributor Author

Thank you @nicolas-grekas for your review, I've fixed your comments

@fabpot
Copy link
Member

fabpot commented Dec 17, 2021

Thank you @sylfabre.

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.

4 participants