Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Validator] Fix translation of AtLeastOneOf constraint message #41325

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

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AtLeastOneOf extends Composite
];

public $constraints = [];
public $message = 'This value should satisfy at least one of the following constraints:';
public $message = 'This value should satisfy at least one of the following constraints: {{ child_messages }}';
Copy link
Member

Choose a reason for hiding this comment

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

As of today, translations are the same in all maintained branches, which simplifies things a lot. That would break this pattern as this message would be different depending on the version. I would love to find another way to fix this issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

Alright, thank you for your feedback. I'll try to get back with another solution! 👍

Copy link
Member

Choose a reason for hiding this comment

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

can't we concatenate the other messages after translating the current message?
that would allow not changing the translation tables

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh I forgot about this one. I'll have a look at it soon and give it another try with your additional info!

public $messageCollection = 'Each element of this collection should satisfy its own set of constraints.';
public $includeInternalMessages = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function validate($value, Constraint $constraint)

$validator = $this->context->getValidator();

$messages = [$constraint->message];
$childMessages = [];

foreach ($constraint->constraints as $key => $item) {
$executionContext = clone $this->context;
Expand All @@ -43,19 +43,20 @@ public function validate($value, Constraint $constraint)
}

if ($constraint->includeInternalMessages) {
$message = ' ['.($key + 1).'] ';
$message = '['.($key + 1).'] ';

if ($item instanceof All || $item instanceof Collection) {
$message .= $constraint->messageCollection;
} else {
$message .= $violations->get(\count($violations) - 1)->getMessage();
}

$messages[] = $message;
$childMessages[] = $message;
}
}

$this->context->buildViolation(implode('', $messages))
$this->context->buildViolation($constraint->message)
->setParameter('{{ child_messages }}', implode(' ', $childMessages))
->setCode(AtLeastOneOf::AT_LEAST_ONE_OF_ERROR)
->addViolation()
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@
<target>Die hoeveelheid elemente in hierdie versameling moet 'n meelvoud van {{ compared_value }} wees.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Hierdie waarde moet voldoen aan ten minste een van hierdie beperkings:</target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>Hierdie waarde moet voldoen aan ten minste een van hierdie beperkings: {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@
<target>يجب أن يكون عدد العناصر في هذه المجموعة مضاعف {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>يجب أن تستوفي هذه القيمة واحدة من القيود التالية:</target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>يجب أن تستوفي هذه القيمة واحدة من القيود التالية: {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@
<target>Bu kolleksiyadakı elementlerin sayı {{ compared_value }} tam bölünəni olmalıdır.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Bu dəyər aşağıdakı məcburiyyətlərdən birini qarşılamalıdır:</target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>Bu dəyər aşağıdakı məcburiyyətlərdən birini qarşılamalıdır: {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@
<target>Колькасць элементаў у гэтай калекцыі павінна быць кратным {{compared_value}}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Значэнне павінна задавальняць як мінімум аднаму з наступных абмежаванняў:</target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>Значэнне павінна задавальняць як мінімум аднаму з наступных абмежаванняў: {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@
<target>Броят на елементите в тази колекция трябва да бъде кратен на {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Стойността трябва да отговаря на поне едно от следните ограничения:</target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>Стойността трябва да отговаря на поне едно от следните ограничения: {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@
<target>Broj elemenata u ovoj kolekciji bi trebalo da bude djeljiv sa {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Ova vrijednost bi trebalo da zadovoljava namjanje jedno od narednih ograničenja:</target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>Ova vrijednost bi trebalo da zadovoljava namjanje jedno od narednih ograničenja: {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@
<target>El nombre d'elements d'aquesta col·lecció ha de ser múltiple de {{compared_value}}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Aquest valor ha de satisfer almenys una de les restriccions següents:</target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>Aquest valor ha de satisfer almenys una de les restriccions següents: {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@
<target>Počet prvků v této kolekci musí být násobek {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Tato hodnota musí splňovat alespoň jedno z následujících omezení:</target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>Tato hodnota musí splňovat alespoň jedno z následujících omezení: {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@
<target>Antallet af elementer i denne samling skal være en multiplikation af {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Værdien skal overholde mindst én af følgende krav:</target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>Værdien skal overholde mindst én af følgende krav: {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@
<target>Die Anzahl an Elementen in dieser Sammlung sollte ein Vielfaches von {{ compared_value }} sein.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Dieser Wert sollte eine der folgenden Bedingungen erfüllen:</target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>Dieser Wert sollte eine der folgenden Bedingungen erfüllen: {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@
<target>Το νούμερο των στοιχείων σε αυτή τη συλλογή θα πρέπει να είναι πολλαπλάσιο του {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Αυτή η τιμή θα πρέπει να ικανοποιεί τουλάχιστον έναν από τους παρακάτω περιορισμούς: </target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>Αυτή η τιμή θα πρέπει να ικανοποιεί τουλάχιστον έναν από τους παρακάτω περιορισμούς: {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@
<target>The number of elements in this collection should be a multiple of {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>This value should satisfy at least one of the following constraints:</target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>This value should satisfy at least one of the following constraints: {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@
<target>El número de elementos en esta colección debería ser múltiplo de {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Este valor debería satisfacer al menos una de las siguientes restricciones:</target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>Este valor debería satisfacer al menos una de las siguientes restricciones: {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@
<target>Bilduma honetako elementu-kopuruak {{ compared_value }}-ren multiploa izan behar luke.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Balio honek, gutxienez, murrizketa hauetako bat bete behar du:</target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>Balio honek, gutxienez, murrizketa hauetako bat bete behar du: {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@
<target>تعداد عناصر این مجموعه باید ضریبی از {{ compared_value }} باشد.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>این مقدار باید حداقل یکی از محدودیت‌های زیر را ارضا کند:</target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>این مقدار باید حداقل یکی از محدودیت‌های زیر را ارضا کند: {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@
<target>Ryhmässä olevien elementtien määrän pitää olla monikerta luvulle {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Tämän arvon tulee läpäistä vähintään yksi seuraavista tarkistuksista:</target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>Tämän arvon tulee läpäistä vähintään yksi seuraavista tarkistuksista: {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@
<target>Le nombre d'éléments de cette collection doit être un multiple de {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Cette valeur doit satisfaire à au moins une des contraintes suivantes :</target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>Cette valeur doit satisfaire au moins une des contraintes suivantes : {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@
<target>O número de elementos desta colección debería ser múltiplo de {{compare_value}}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Este valor debe cumprir polo menos unha das seguintes restricións:</target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>Este valor debe cumprir polo menos unha das seguintes restricións: {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@
<target>מספר האלמנטים באוסף זה צריך להיות מכפיל של {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>ערך זה אמור לעמוד לפחות באחד התנאים הבאים:</target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>ערך זה אמור לעמוד לפחות באחד התנאים הבאים: {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@
<target>Broj elemenata u kolekciji treba biti djeljiv s {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Ova vrijednost mora zadovoljiti jedan od sljedećih ograničenja:</target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>Ova vrijednost mora zadovoljiti jedan od sljedećih ograničenja: {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@
<target>A gyűjteményben lévő elemek számának oszthatónak kell lennie a következővel: {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Ennek az értéknek meg kell felelni legalább egynek a következő feltételek közül:</target>
<source>This value should satisfy at least one of the following constraints: {{ child_messages }}</source>
<target>Ennek az értéknek meg kell felelni legalább egynek a következő feltételek közül: {{ child_messages }}</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.