symfony - Pass variables to Twig Translator -


in messages.en.yml:

variable_name: welcome %site_name% - %other_info% 

in twig

{{ 'variable_name'|trans( -here- ) }} 

it's -here- part i'm struggling know how pass data in. must way (above example).

maybe i'm misunderstanding question if understand correctly, need give array first parameter of trans filter.

{{ 'variable_name'|trans({'%site_name%': 'my website'}) }} 

and of course, values can variables if don't put them between quotes :

{{ 'variable_name'|trans({'%site_name%': 'my website', '%other_info%': page_name}) }} 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -