-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Translation] Translation docs consolidation #17815
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
[Translation] Translation docs consolidation #17815
Conversation
@@ -26,6 +26,11 @@ into the language of the user:: | |||
*language* code, an underscore (``_``), then the `ISO 3166-1 alpha-2`_ | |||
*country* code (e.g. ``fr_FR`` for French/France) is recommended. | |||
|
|||
Translations can be organized into groups, called **domains**. By default, all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Domains were not described anywhere, except in the section about translation file names.
@@ -103,19 +108,17 @@ are located: | |||
; | |||
}; | |||
|
|||
The locale used in translations is the one stored on the request. This is | |||
typically set via a ``_locale`` attribute on your routes (see :ref:`translation-locale-url`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved where it is more relevant.
|
||
#. If the message is located in the catalog, the translation is returned. If | ||
not, the translator returns the original message. | ||
|
||
.. tip:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed anymore as described earlier already.
@@ -297,22 +294,6 @@ To manage these situations, Symfony follows the `ICU MessageFormat`_ syntax by | |||
using PHP's :phpclass:`MessageFormatter` class. Read more about this in | |||
:doc:`/translation/message_format`. | |||
|
|||
.. tip:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why we would want to add a tip about something we don't recommend anymore.
@@ -362,6 +343,41 @@ Translations in Templates | |||
Most of the time, translation occurs in templates. Symfony provides native | |||
support for both Twig and PHP templates. | |||
|
|||
.. _translation-filters: | |||
|
|||
Using Twig Filters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filters moved before tags as this is the recommended way IMO (because of the escaping difference).
Note that this only influences the current template, not any "included" | ||
template (in order to avoid side effects). | ||
|
||
By default, the translated messages are output escaped; apply the ``raw`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've split the escaping caution to add the relevant information in each section.
For any other storage, you need to provide a custom class implementing the | ||
:class:`Symfony\\Component\\Translation\\Loader\\LoaderInterface` | ||
interface. See the :ref:`dic-tags-translation-loader` tag for more | ||
information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's consolidate everything related to databases in one place.
@@ -617,9 +591,9 @@ them the new contents to translate frequently and merge the results back in the | |||
application. | |||
|
|||
Instead of doing this manually, Symfony provides integration with several | |||
third-party translation services (e.g. Crowdin or Lokalise). You can upload and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to reference names here
230b796
to
60b5460
Compare
Thanks Fabien for this nice content reorganization and for the detailed explanations! |
No description provided.