File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change 4
4
How to Translate Validation Constraint Messages
5
5
===============================================
6
6
7
- If you're using validation constraints with the Form component, you can translate
8
- the error messages by creating a translation resource for the
9
- `` validators `` :ref: `domain <translation-resource-locations >`.
7
+ The validation constraints used in forms can translate their error messages by
8
+ creating a translation resource for the `` validators ``
9
+ :ref: `translation domain <translation-resource-locations >`.
10
10
11
- .. note ::
11
+ First of all, install the Symfony translation component (if it's not already
12
+ installed in your application) running the following command:
12
13
13
- In order to translate the error message, you should have installed the
14
- symfony/translation component with Composer.
14
+ .. code-block :: terminal
15
15
16
- To start, suppose you've created a plain-old-PHP object that you need to
17
- use somewhere in your application::
16
+ $ composer require symfony/translation
17
+
18
+ Suppose you've created a plain-old-PHP object that you need to use somewhere in
19
+ your application::
18
20
19
21
// src/Entity/Author.php
20
22
namespace App\Entity;
You can’t perform that action at this time.
0 commit comments