我有一个Sylius实例,配置了翻译文件并正常工作
现在在我的twig
中使用这样的代码片段:
{{ 'project.sylius.frontend.header.label'|trans }}
它从yaml
翻译文件中检索适当的字符串:
project.sylius.frontend.header.title: Welcome here
我想知道的是,如果有机会将具有插值标记的字符串直接存储在yaml
中,像这样:
project.sylius.frontend.cart_number: you are going to buy %n candies
project.sylius.frontend.delivery: delivery will be between the %whatever and %whatever
以及如何传递twig
文件中的变量
您可以将变量作为数组的第一个参数传递给跨过滤器,例如:
yaml :
project.sylius.frontend.cart_number: you are going to buy %number% candies
枝:
{{ 'project.sylius.frontend.cart_number '|trans({'%number%': '4'}) }}
看一下复数形式的特点。
希望对您有所帮助