I'm currently using Twig templates and translations in a symfony project and a little problem came up.
I've checked the documentation but I can't figure that out.
I have a translation file (in yml), its configuration's like this.
productMissingMessage: El producto con referencia %productRef% ha sido descatalogado en nuestra tienda.
In the twig template, I have something like this:
{% for product in productsDeleted %}
<p>{{'basket.productMissingMessage'|trans }}</p>
{% endfor %}
It may sound stupid, but I'm struggling in how to add a parameter in there to get the value out to the trans file. I've seen in the documentation that you can add a string or a number, but never a variable, in this case, the variable will be {product}.
This is a documentation example:
{{ message|trans({'%name%': 'Fabien'}, "app") }}
Any idea how to pass the value of the variable? I've tried with {{product}} but nope.
Thank you and have a nice day!
Could you try this:
{% for product in productsDeleted %}
<p>{{'basket.productMissingMessage'|trans({'%productRef%': product}, "app") }}</p>
{% endfor %}