@@ -357,23 +357,27 @@ with these tasks:
357
357
358
358
.. code-block :: terminal
359
359
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
361
361
$ php bin/console translation:update --dump-messages --force fr
362
362
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.
365
375
366
376
.. note ::
367
377
368
378
If you want to see the missing translation strings without actually updating
369
379
the translation files, remove the ``--force `` option from the command above.
370
380
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
-
377
381
.. _translation-resource-locations :
378
382
379
383
Translation Resource/File Names and Locations
@@ -564,4 +568,3 @@ Learn more
564
568
.. _`ISO 639-1` : https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
565
569
.. _`Translatable Extension` : http://atlantic18.github.io/DoctrineExtensions/doc/translatable.html
566
570
.. _`Translatable Behavior` : https://github.com/KnpLabs/DoctrineBehaviors
567
- .. _`TranslationBundle` : https://github.com/php-translation/symfony-bundle
0 commit comments