is possible use global variable config.yml in translation file in symfony 2? if yes, please can give example or useful link?
you can follow 2 simple steps:
inject global variable in templates using twig configuration:
# app/config/parameters.yml parameters: my_favorite_website: www.stackoverflow.comand
# app/config/config.yml twig: globals: my_favorite_website: "%my_favorite_website%"use message placeholders have ability place text in translation:
# messages.en.yml i.love.website: "i love %website%!!" # messages.fr.yml i.love.website: "j'adore %website%!!"
you can use following twig syntax in templates expected result:
{{ 'i.love.website'|trans({'%website%': my_favorite_website}) }}
Comments
Post a Comment