I'm trying to gererate the translation key that has to be translated and show at the template but is not working
<h2 class="text-withe">{{ 'cover.title.'~product.id | trans | raw }}</h2>
this way it works, but I think it should work without create a variable
{% set title_key = 'cover.title.'~product.id %}
<h2 class="text-white">{{ title_key | trans | raw }}</h2>
when you put |
it just look for the value before |
all you have to do is use parentheses you show that you one translate all of that like this:
('cover.title.'~product.id)| trans | raw