Skip to content

[Translation] Mention enabled_locales #19411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions translation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ are located:
;
};

Additionally, you can enable only some locales instead of all of them. You can
do this by using the
:ref:`dedicated option <reference-translator-enabled-locales>` in your
configuration.

.. _translation-basic:

Basic Translation
Expand Down Expand Up @@ -256,9 +261,10 @@ using the ``trans()`` method:

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

#. If the message is located in the catalog, the translation is returned. If
not, the translator returns the original message.
Expand Down
5 changes: 4 additions & 1 deletion validation/translations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ Now, create a ``validators`` catalog file in the ``translations/`` directory:
];

You may need to clear your cache (even in the dev environment) after creating
this file for the first time.
this file for the first time. You may also need to enable the locale in your
application configuration. This can be done by setting the
:ref:`enabled_locales <reference-translator-enabled-locales>` option in
your configuration files.

You can also use :class:`Symfony\\Component\\Translation\\TranslatableMessage` to build your violation message::

Expand Down