Skip to content

Commit 04d5a37

Browse files
committed
minor #21047 [Validator] Mention how to disable validation translation in ConstraintViolationBuilderInterface (javiereguiluz)
This PR was squashed before being merged into the 6.4 branch. Discussion ---------- [Validator] Mention how to disable validation translation in ConstraintViolationBuilderInterface Fixes #18325. When upmerging, add this phrase starting in 7.3 branch: ```rst See also the :ref:`framework.validation.disable_translation option <reference-validation-disable_translation>`. ``` Commits ------- d05f748 [Validator] Mention how to disable validation translation in ConstraintViolationBuilderInterface
2 parents 5cda87c + d05f748 commit 04d5a37

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

validation/custom_constraint.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,16 @@ message as its argument and returns an instance of
180180
:class:`Symfony\\Component\\Validator\\Violation\\ConstraintViolationBuilderInterface`.
181181
The ``addViolation()`` method call finally adds the violation to the context.
182182

183+
.. tip::
184+
185+
Validation error messages are automatically translated to the current application
186+
locale. If your application doesn't use translations, you can disable this behavior
187+
by calling the ``disableTranslation()`` method of ``ConstraintViolationBuilderInterface``.
188+
189+
.. versionadded:: 6.4
190+
191+
The ``disableTranslation()`` method was introduced in Symfony 6.4.
192+
183193
Using the new Validator
184194
-----------------------
185195

0 commit comments

Comments
 (0)