-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Fix translation of AtLeastOneOf constraint message #49484
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
[Validator] Fix translation of AtLeastOneOf constraint message #49484
Conversation
37e840a
to
a21eb9d
Compare
Can't we have a test with dummy translations in any locale? |
I'll have a look at it 👍 |
a21eb9d
to
c45760a
Compare
The test has been added with a dummy 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.
see fabbot :)
|
||
public function trans(?string $id, array $parameters = [], string $domain = null, string $locale = null): string | ||
{ | ||
if ($id === 'This value should satisfy at least one of the following constraints:') { |
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.
let's add another case to also translate "This value should be null."?
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.
This should be it! Also renamed the test case to be more relevant 🙂
c45760a
to
2b1fa28
Compare
2b1fa28
to
a687c9a
Compare
Thank you @alexandre-daubois. |
…sage (alexandre-daubois) This PR was merged into the 5.4 branch. Discussion ---------- [Validator] Fix translation of AtLeastOneOf constraint message | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #41317 | License | MIT | Doc PR | _NA_ New try after Nicolas' hint on symfony/symfony#41325. This is a much simpler solution using execution context to get the base message of the constraint translated. ~I tried to create the relevant test case, but other locales doesn't seem to be available in validators test cases.~ I'm having a look at a test case in a dummy locale after symfony/symfony#49484 (comment) When using another locale, the base message of the constraint is actually translated now: <img width="1238" alt="image" src="https://user-images.githubusercontent.com/2144837/220455120-c17e7ac6-81c5-4dd0-a2fc-b100a6a00688.png"> Commits ------- a687c9a2a0 [Validator] Fix translation of AtLeastOneOf constraint message
New try after Nicolas' hint on #41325.
This is a much simpler solution using execution context to get the base message of the constraint translated.
I tried to create the relevant test case, but other locales doesn't seem to be available in validators test cases.I'm having a look at a test case in a dummy locale after #49484 (comment)When using another locale, the base message of the constraint is actually translated now: