-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Translation] TransChoice invalid plural translation #31110
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
[Translation] TransChoice invalid plural translation #31110
Conversation
d3ded2f
to
f979dea
Compare
f979dea
to
9c13ce2
Compare
src/Symfony/Bundle/FrameworkBundle/Resources/config/identity_translator.xml
Show resolved
Hide resolved
and this does not solve the similar issue when using the ICU format (MessageFormatter also throws for invalid pluralization) |
9c13ce2
to
8a87162
Compare
First of all thanks @ro0NL and @nicolas-grekas for the review, I'm working on this right now and wanted to know what we should return, an empty string ? Do we update all the translation components (such as TranslationExtension, MessageFormatter) or do we only do that on the transChoice of the IdentityTranslator so we are strictly following the issue. (that's what I've done right now, tell me if we want to go further. |
8a87162
to
0aa48c2
Compare
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.
what we should return
the default behavior?
return strtr($id, $parameters); |
@@ -10,7 +10,9 @@ | ||
<service id="Symfony\Component\Translation\TranslatorInterface" alias="translator" /> |
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.
the default identity translator above this one should be updated as well.. might even be a public alias to identity_translator
🤔
last but not least; |
@ro0NL I don't know, I think it could be on the user at this point. |
0aa48c2
to
a7fef52
Compare
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.
@Simperfit isnt it weird transChoice
is "debug-able" whereas trans()
is not? Esp. since transChoice
is deprecated.. so $debug
is useless in 5.0?
Moreover, what to do with
symfony/src/Symfony/Component/Validator/ValidatorBuilder.php
Lines 336 to 338 in a7fef52
$translator = new class() implements TranslatorInterface, LocaleAwareInterface { | |
use TranslatorTrait; | |
}; |
trans can throw in 2 cases:
|
So what to do here ? Do we need to not throw and pass the debug directly in the trans method ? |
8a3fdb5
to
1ee08d4
Compare
1ee08d4
to
c7f5cf7
Compare
I like how it's working right now @stof @nicolas-grekas tell me if I need to change something. |
Status: Needs Review |
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.
Do we need to update other usage of the TranslatorTrait
(in Symfony\Bridge\Twig\Extension\TranslationExtension
and Symfony\Component\Validator\ValidatorBuilder
) too?
And we need to mark any version of the Translation component as conflicting with the FrameworkBundle.
src/Symfony/Bundle/FrameworkBundle/Resources/config/identity_translator.xml
Outdated
Show resolved
Hide resolved
0732cc5
to
c3d6800
Compare
I don't know, maybe @ro0NL has some thoughts on this ? |
c3d6800
to
1669eab
Compare
Status: Needs Review |
cc @xabbuh |
A test case would be nice please (+rebase needed) |
1669eab
to
47d6d7e
Compare
src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php
Outdated
Show resolved
Hide resolved
It will be very cool to have it in 4.4 as a bug fix, but i fear it will not be considered as it thank you working on this @Simperfit :) |
47d6d7e
to
5c5420b
Compare
Closing as this staled. |
@nicolas-grekas hello |
I fixed all comments before closing so yes, this should be good to go on master, but with enough description in the PR to be able to understand the use case and that could act as the start of a documentation. |
@nicolas-grekas related to #28375 and as this is not considered as a bugfix, IMO sf 3 and 4 can not benefit this thank you |
I don't know :) |
Uh oh!
There was an error while loading. Please reload this page.