Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Validator] Add missing translations #36165

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
Mar 23, 2020
Merged
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
4 changes: 2 additions & 2 deletions src/Symfony/Component/Validator/Constraints/AtLeastOneOf.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
*/
class AtLeastOneOf extends Composite
{
public const AT_LEAST_ONE_ERROR = 'f27e6d6c-261a-4056-b391-6673a623531c';
public const AT_LEAST_ONE_OF_ERROR = 'f27e6d6c-261a-4056-b391-6673a623531c';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've also noticed that the error name is not consistent with the classname.


protected static $errorNames = [
self::AT_LEAST_ONE_ERROR => 'AT_LEAST_ONE_ERROR',
self::AT_LEAST_ONE_OF_ERROR => 'AT_LEAST_ONE_OF_ERROR',
];

public $constraints = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function validate($value, Constraint $constraint)
}

$this->context->buildViolation(implode('', $messages))
->setCode(AtLeastOneOf::AT_LEAST_ONE_ERROR)
->setCode(AtLeastOneOf::AT_LEAST_ONE_OF_ERROR)
->addViolation()
;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,14 @@
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
<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>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
<target>Each element of this collection should satisfy its own set of constraints.</target>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,14 @@
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
<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>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@javiereguiluz Once again, I put my Spanish to the test.

Copy link
Member

Choose a reason for hiding this comment

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

👍 The proposed translation is perfect! Thanks.

</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
<target>Cada elemento de esta colección debería satisfacer su propio conjunto de restricciones.</target>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,14 @@
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
<target>Liczba elementów w tym zbiorze powinna być wielokrotnością {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Ta wartość powinna spełniać co najmniej jedną z następujących reguł:</target>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pizzaminded Since you've helped me before, maybe you could have a look at this translation? I had doubts whether to use ograniczenie instead of reguła (for translating constraint), but I think that the second one is more natural and commonly used.

Copy link
Contributor

Choose a reason for hiding this comment

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

For me, reguła sounds better. Ograniczenie is more about limiting something (e.g count of choices etc.) than "fitting" to requirements.

</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
<target>Każdy element w tym zbiorze powinien spełniać własny zestaw reguł.</target>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function testInvalidCombinationsWithDefaultMessage($value, $constraints)

$this->validator->validate($value, $atLeastOneOf);

$this->buildViolation(implode('', $message))->setCode(AtLeastOneOf::AT_LEAST_ONE_ERROR)->assertRaised();
$this->buildViolation(implode('', $message))->setCode(AtLeastOneOf::AT_LEAST_ONE_OF_ERROR)->assertRaised();
}

/**
Expand All @@ -124,7 +124,7 @@ public function testInvalidCombinationsWithCustomMessage($value, $constraints)

$this->validator->validate($value, $atLeastOneOf);

$this->buildViolation('foo')->setCode(AtLeastOneOf::AT_LEAST_ONE_ERROR)->assertRaised();
$this->buildViolation('foo')->setCode(AtLeastOneOf::AT_LEAST_ONE_OF_ERROR)->assertRaised();
}

public function getInvalidCombinations()
Expand Down