In my translation.yml I have this var:
all.in.EN: All In Great Britain
In my Twig I have something like this:
{% trans %}all.in.{{ countryKey }}{% endtrans %}
This doesn't work so I tried to put this in a variable:
{% set allInName = 'all.in.{{ countryKey }}' %}
{% trans %}allInName{% endtrans %}
But then the output is allInName
and not the translation. Someone an idea what I'm doing wrong?
THNAKS!
You could try to do it like this :
{{ ('all.in.'~countryKey)|trans }}
already tested this works. the '~' sign is to concatenate, and |trans filter translate
Try
{% set allInName = 'all.in.' ~ countryKey %}
{{allInName | trans}}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With