Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

symfony translation keys formed with variables

In a twig template is it possible to form translation key with a variable in it ?

Like

{% trans %}detail.label.price.{{membership}}.credit{% endtrans %}

or

{% set str = "detail.label.price"+membership+".credit"|trans %}

like image 458
svassr Avatar asked Jun 13 '12 02:06

svassr


1 Answers

{{ ('detail.label.price.' ~ membership ~ '.credit')|trans }}
like image 101
Elnur Abdurrakhimov Avatar answered Oct 05 '22 15:10

Elnur Abdurrakhimov