symfony2 - Add prefix to twig trans filter -



symfony2 - Add prefix to twig trans filter -

i have messages.de.yml looks like

... profile: ... availability: ... 4_week: vier mal pro woche ... ...

(the ... not of import example)

i have user class has field called availability. want display field in user's profile , translate it. let's assume value of user.availability "4_week"

this code working:

{{ ("profile.availability." ~ user.availability)|trans }}

but recommended way? tried using profile.availability / messages.profile.availability domain:

{{ user.availability|trans({}, "profile.availability") }}

but output 4_week , not "vier mal pro woche" expected.

simon

yes, recommended way.

symfony2 dns twig translation yaml

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -