Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
messages.en.yml で:
variable_name: Welcome to %site_name% - %other_info%
小枝で
{{ 'variable_name'|trans( -here- ) }}
これは、データを渡す方法を知るのに苦労している -here- の部分です。この方法で行う必要があります (上記は単なる例です)。
質問を誤解しているかもしれませんが、正しく理解できれば、trans フィルターの最初のパラメーターとして配列を指定するだけで済みます。
{{ 'variable_name'|trans({'%site_name%': 'My Website'}) }}
そしてもちろん、値を引用符で囲まなければ、値を変数にすることができます:
{{ 'variable_name'|trans({'%site_name%': 'My Website', '%other_info%': page_name}) }}