Skip to content

Commit dd8640e

Browse files
committed
minor #15017 [Translation][Validator] Mention symfony/translation (wkania)
This PR was merged into the 4.4 branch. Discussion ---------- [Translation][Validator] Mention symfony/translation First, when I was checking the PHP attributes syntax for the message, I encounter a problem that the message is not translated. There was no error. The problem was I didn't install `symfony/translation ` . So maybe we should mention this? Second the text: > Now, create a ``validators`` catalog file in the ``translations/`` directory: inform us to create a structure like `translations/validators` but the commented path in the examples is different. <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `5.x` for features of unreleased versions). --> Commits ------- c4a398e [Validator][Translation] Mention symfony/translation
2 parents f408efa + c4a398e commit dd8640e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

validation/translations.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ If you're using validation constraints with the Form component, you can translat
88
the error messages by creating a translation resource for the
99
``validators`` :ref:`domain <translation-resource-locations>`.
1010

11+
.. note::
12+
13+
In order to translate the error message, you should have installed the
14+
symfony/translation component with Composer.
15+
1116
To start, suppose you've created a plain-old-PHP object that you need to
1217
use somewhere in your application::
1318

@@ -93,7 +98,7 @@ Now, create a ``validators`` catalog file in the ``translations/`` directory:
9398

9499
.. code-block:: xml
95100
96-
<!-- translations/validators.en.xlf -->
101+
<!-- translations/validators/validators.en.xlf -->
97102
<?xml version="1.0"?>
98103
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
99104
<file source-language="en" datatype="plaintext" original="file.ext">
@@ -108,12 +113,12 @@ Now, create a ``validators`` catalog file in the ``translations/`` directory:
108113
109114
.. code-block:: yaml
110115
111-
# translations/validators.en.yaml
116+
# translations/validators/validators.en.yaml
112117
author.name.not_blank: Please enter an author name.
113118
114119
.. code-block:: php
115120
116-
// translations/validators.en.php
121+
// translations/validators/validators.en.php
117122
return [
118123
'author.name.not_blank' => 'Please enter an author name.',
119124
];

0 commit comments

Comments
 (0)