Symfony2: HTML inside translation message

后端 未结 9 1800
醉话见心
醉话见心 2020-12-09 02:12

In messages.en.yml, I have

confirmed: Congrats %username%, your account is now activated.

But I want to \'bold\' username to

9条回答
  •  情书的邮戳
    2020-12-09 02:36

    Holding HTML stuff in translations is wrong, because translators usually break it. But if you really need it:

    Twig:

    {% trans %}confirmed{% endtrans %}
    

    Yaml translation file:

    confirmed: 'Congrats %username%, your account is now activated.'
    

    Discussion about this: https://github.com/symfony/symfony/issues/2713

提交回复
热议问题