From 77089fa264786081748cd1d90c331784c2882b50 Mon Sep 17 00:00:00 2001 From: Nate Wiebe Date: Fri, 5 Mar 2021 15:35:03 -0500 Subject: [PATCH] Update docs relating to translation extraction --- translation.rst | 5 +++++ translation/debug.rst | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/translation.rst b/translation.rst index 8153d000531..b8e61251893 100644 --- a/translation.rst +++ b/translation.rst @@ -292,6 +292,8 @@ 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`. +.. _translatable-objects: + Translatable Objects -------------------- @@ -386,6 +388,9 @@ The ``translation:update`` command looks for missing translations in: :ref:`twig.paths ` config options); * Any PHP file/class that injects or :doc:`autowires ` the ``translator`` service and makes calls to the ``trans()`` method. +* Any PHP file/class stored in the ``src/`` directory that creates + :ref:`translatable-objects` using the constructor or the ``t()`` method or calls + the ``trans()`` method. .. _translation-resource-locations: diff --git a/translation/debug.rst b/translation/debug.rst index 74e52783245..c511d7c9777 100644 --- a/translation/debug.rst +++ b/translation/debug.rst @@ -19,9 +19,10 @@ command helps you to find these missing or unused translation messages templates .. caution:: - The extractors can't find messages translated outside templates, like form - labels or controllers. Dynamic translations using variables or expressions - in templates are not detected either: + The extractors can't find messages translated outside templates (like form + labels or controllers) unless using :ref:`translatable-objects` or calling + the ``trans()`` method on a translator. Dynamic translations using variables + or expressions in templates are not detected either: .. code-block:: twig