【发布时间】:2015-03-13 17:41:52
【问题描述】:
如何在 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
我该如何解决这个问题?
【问题讨论】:
标签: php symfony twig translate