我用我的模板樹枝trans
標籤,我想通過變量的原因,像這樣:嫩枝「反式」不工作
{% trans with {
'%link_start%': '<a href="http://www.google.nl/">',
'%link_end%': '</a>'
} %}
This %link_start%disclaimer%link_end% applies to all of our messages.
{% endtrans %}
但是這給了我下面的異常指向在{% trans with
線樹枝模板:
PHP Fatal error: Uncaught exception 'Twig_Error_Syntax' with message 'Unexpected token "punctuation" of value "{" ("end of statement block" expected).' in [twig-template:line]
即使當我複製粘貼&從Symfony documentation的例子中,我得到了同樣的異常。所以我不知所措,我在這裏做錯了什麼?
FYI:我使用的嫩枝1.33對國際化擴展啓用(和我不使用Symfony框架)
好的,這解釋了官方枝條網站上丟失的文檔頁面。但是,謝謝你的回答!我想我會使用SF翻譯組件,因爲它比jhogeverst的Twi18n更新得更頻繁。 –