Skip to content

Commit f82ad62

Browse files
committed
Mentioned the extraction of translation contents from PHP files
1 parent e26c419 commit f82ad62

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

reference/configuration/twig.rst

+2
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ on. Set it to ``0`` to disable all the optimizations. You can even enable or
301301
disable these optimizations selectively, as explained in the Twig documentation
302302
about `the optimizer extension`_.
303303

304+
.. _config-twig-default-path:
305+
304306
default_path
305307
~~~~~~~~~~~~
306308

translation.rst

+13-10
Original file line numberDiff line numberDiff line change
@@ -357,23 +357,27 @@ with these tasks:
357357

358358
.. code-block:: terminal
359359
360-
# updates the French translation file with the missing strings found in templates/
360+
# updates the French translation file with the missing strings for that locale
361361
$ php bin/console translation:update --dump-messages --force fr
362362
363-
# updates the English translation file with the missing strings found in AppBundle
364-
$ php bin/console translation:update --dump-messages --force en AppBundle
363+
The ``translation:update`` command looks for missing translations in:
364+
365+
* Templates stored in the ``templates/`` directory (or any other directory
366+
defined in the :ref:`twig.default_path <config-twig-default-path>` and
367+
:ref:`twig.paths <config-twig-paths>` config options);
368+
* Any PHP file/class that injects or :doc:`autowires </service_container/autowiring>`
369+
the ``translator`` service and makes calls to the ``trans()`` function.
370+
371+
.. versionadded:: 4.3
372+
373+
The extraction of missing translation strings from PHP files was introduced
374+
in Symfony 4.3.
365375

366376
.. note::
367377

368378
If you want to see the missing translation strings without actually updating
369379
the translation files, remove the ``--force`` option from the command above.
370380

371-
.. tip::
372-
373-
If you need to extract translation strings from other sources, such as
374-
controllers, forms and flash messages, consider using the more advanced
375-
third-party `TranslationBundle`_.
376-
377381
.. _translation-resource-locations:
378382

379383
Translation Resource/File Names and Locations
@@ -564,4 +568,3 @@ Learn more
564568
.. _`ISO 639-1`: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
565569
.. _`Translatable Extension`: http://atlantic18.github.io/DoctrineExtensions/doc/translatable.html
566570
.. _`Translatable Behavior`: https://github.com/KnpLabs/DoctrineBehaviors
567-
.. _`TranslationBundle`: https://github.com/php-translation/symfony-bundle

0 commit comments

Comments
 (0)