如何在 translation.en.yml 中传递变量
How to pass the variable in translation.en.yml
我在 twig 中使用 translation.en.yml。
我想做的很简单,请看下面的代码
在我的树枝上
{{ "message.thxContactUs" | trans({'%username%' : "myName"})}}
在我的 translation.en.yml
message:
thxContactUs: Dear {{username}} thank you for contacting us
但是这个输出是
Dear {{username}} thank you for contacting us
但是它不起作用,请问有人可以更正此代码吗??
你必须这样在yml中输入变量:
message:
thxContactUs: Dear %username% thank you for contacting us
检查这个问题:
How to handle Translation in twig file using variables?
我在 twig 中使用 translation.en.yml。
我想做的很简单,请看下面的代码
在我的树枝上
{{ "message.thxContactUs" | trans({'%username%' : "myName"})}}
在我的 translation.en.yml
message:
thxContactUs: Dear {{username}} thank you for contacting us
但是这个输出是
Dear {{username}} thank you for contacting us
但是它不起作用,请问有人可以更正此代码吗??
你必须这样在yml中输入变量:
message:
thxContactUs: Dear %username% thank you for contacting us
检查这个问题:
How to handle Translation in twig file using variables?