0
如何使用多個變量在symfony中翻譯字符串沒有他們之間的空白?使用symfony中翻譯字符串多個變量沒有空格
這個例子的工作原理,但它的變量之間的空白
{% trans with {
'%name%': customer.getPlausibleFirstName(),
'%city%': customer.getCity(),
'%accentStart%': '<strong>',
'%accentEnd%': '</strong>',
}%}%accentStart% %name% %accentEnd% from %accentStart% %city% %accentEnd% would like a quote{% endtrans %}
我真正想要做的是:
{% trans with {
'%name%': customer.getPlausibleFirstName(),
'%city%': customer.getCity(),
'%accentStart%': '<strong>',
'%accentEnd%': '</strong>',
}%}%accentStart%%name%%accentEnd% from %accentStart%%city%%accentEnd% would like a quote{% endtrans %}
這最後的版本將引發以下錯誤:
Variable " from " does not exist in ApplicationBundle:Default:header.html.twig at line 13
請問該如何解決這個問題?