Skip to content

[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

Merged
merged 1 commit into from
Jan 27, 2023

Conversation

fabpot
Copy link
Member

@fabpot fabpot commented Jan 27, 2023

No description provided.

@carsonbot carsonbot added this to the 5.4 milestone Jan 27, 2023
@@ -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
Copy link
Member Author

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`).
Copy link
Member Author

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::
Copy link
Member Author

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::
Copy link
Member Author

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
Copy link
Member Author

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``
Copy link
Member Author

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.
Copy link
Member Author

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
Copy link
Member Author

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

@carsonbot carsonbot changed the title Translation docs consolidation [Translation] Translation docs consolidation Jan 27, 2023
@javiereguiluz javiereguiluz force-pushed the translation-docs-consolidation branch from 230b796 to 60b5460 Compare January 27, 2023 14:58
@javiereguiluz
Copy link
Member

Thanks Fabien for this nice content reorganization and for the detailed explanations!

@javiereguiluz javiereguiluz merged commit f08ddda into symfony:5.4 Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants