Skip to content

Commit d05f748

Browse files
committed
[Validator] Mention how to disable validation translation in ConstraintViolationBuilderInterface
1 parent f5af7bd commit d05f748

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)