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

php - How to pass multiple values from url -

php - Laravel not returning controller -

c# - Confused on how to specify a Platform and Version while using ChromeOptions for RemoteWebDriver with Selenium donNet since recent updates -