Contributed by
Mathieu Santostefano
in #46161.
Symfony includes a translation:extract command that looks for translatable contents in Twig templates and PHP files/classes to update the translation files with all the new contents found.
Behind the scenes, a PhpExtractor
service uses the token_get_all()
function
to find those translatable strings. This works well in most cases, but it's
increasingly difficult to add support for newer PHP features such as named arguments.
That's why in Symfony 6.2 we're introducing a new AST-based translation extractor. It uses the popular nikic/php-parser library to properly parse the contents of PHP files and process them as traversable nodes.
The new PhpAstExtractor
service supports all kinds of trans()
function calls,
usages of TranslatableMessage
class, messages defined in validation constraints, etc.
Thanks to its solid AST-based foundation, we'll improve it and will add support
for new PHP features much faster than before.
To use the new translation extractor, update your project to Symfony 6.2 and
install the nikic/php-parser
package using Composer. That's all. There's
nothing else to configure or change in your project.
<hr style="margin-bottom: 5px" />
<div style="font-size: 90%">
<a href="https://symfony.com/sponsor">Sponsor</a> the Symfony project.
</div>
Accedi per aggiungere un commento
Altri post in questo gruppo

Symfony's bridge packages integrate third-party services, such as mailers, notifiers, and translation providers, into Symfony applications. With more than 120 bridges available today, Symfony supports

Symfony Messenger component keeps evolving to meet the needs of complex, modern applications. In Symfony 7.3, we're introducing several powerful features to it.
Run Process Using the Shell… https://s

The Routing component provides an impressive list of features to map incoming URLs to your application code. Symfony 7.3 pushes it even further with a set of new features that improve developer experi

Contributed by Mathias Arlaud in

Affected versions
Symfony UX symfony/ux-live-component and symfony/ux-twig-component versions <2.25.1 are affected by this security issue.
The issue has been fixed in the 2.25.1 version of these

Symfony has been reducing the need for configuration in applications for several years now. Thanks to PHP attributes, you can now configure most things alongside the relevant code, removing the need f

This week, development activity focused on polishing Symfony 7.3 ahead of its final release in two weeks. We also continued publishing articles highlighting the new features of Symfony 7.3 and shared