Is it possible to translate the value of twig variables in a template with the 'trans' tag?
Say for instance I am passing a product to my template. This product has a definition with a trans tag e.g {{ product.definition|trans }}
. This definition could either be in EN or DE or some other language. How could I translate the definition.
If
{{ product.definition }}
equals 'cellphone' the following should work.message.language.yml:
However if you want to map it with the 'product' key in your message file like this:
add the key to the twig template like so: