Skip to content

Commit 42d965b

Browse files
committed
Merge branch '7.0' into 7.1
* 7.0: [Translation] Mention `enabled_locales`
2 parents e1fd4ac + 962cbd7 commit 42d965b

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

translation.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ are located:
104104
;
105105
};
106106
107+
.. tip::
108+
109+
You can also define the :ref:`enabled_locales option <reference-translator-enabled-locales>`
110+
to restrict the locales that your application is available in.
111+
107112
.. _translation-basic:
108113

109114
Basic Translation
@@ -256,9 +261,10 @@ using the ``trans()`` method:
256261

257262
#. A catalog of translated messages is loaded from translation resources
258263
defined for the ``locale`` (e.g. ``fr_FR``). Messages from the
259-
:ref:`fallback locale <translation-fallback>` are also loaded and added to
260-
the catalog if they don't already exist. The end result is a large
261-
"dictionary" of translations.
264+
:ref:`fallback locale <translation-fallback>` and the
265+
:ref:`enabled locales <reference-translator-enabled-locales>` are also
266+
loaded and added to the catalog if they don't already exist. The end result
267+
is a large "dictionary" of translations.
262268

263269
#. If the message is located in the catalog, the translation is returned. If
264270
not, the translator returns the original message.

validation/translations.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,14 @@ Now, create a ``validators`` catalog file in the ``translations/`` directory:
123123
You may need to clear your cache (even in the dev environment) after creating
124124
this file for the first time.
125125

126+
.. tip::
127+
128+
Symfony will also create translation files for the built-in validation messages.
129+
You can optionally set the :ref:`enabled_locales <reference-translator-enabled-locales>`
130+
option to restrict the available locales in your application. This will improve
131+
performance a bit because Symfony will only generate the translation files
132+
for those locales instead of all of them.
133+
126134
You can also use :class:`Symfony\\Component\\Translation\\TranslatableMessage` to build your violation message::
127135

128136
use Symfony\Component\Translation\TranslatableMessage;

0 commit comments

Comments
 (0)