Symfony translation with placeholder doesn’t work

  internationalization, php, symfony, translate, twig

I’m trying to translate my app with Symfony translate (5.1.*). I use Symfony 5.1.
Basic translation work fine but I have problem with variable in twig.

When I do
{% trans with {'%name%': 'World'} from 'app' %}Hello %name%{% endtrans %}

It works fine and the result is Hello World as expected. But if I do

php bin/console translation:update --force en
php bin/console cache:clear

to generate the translation file, the result is Hello %name%.

If in the translation file, I delete this reference:

<trans-unit id="yhpYN0i" resname="Hello %name%">
    <source>Hello %name%</source>
    <target>Hello %name%</target>

the result is again Hello World.

Anybody has any idea why the translation file doesn’t work when using a variable?

Source: Symfony Questions