Symfony2: HTML inside translation message

Update 2

In such cases, I started to use like this:

confirmed: Congrats %start_link%%username%%end_link%, your account is now activated

Since separation of concerns is maintained, this way is strongly recommended.


Update

In YAML, I have used translations like this without any problem:

trans.key: click <a href="https://stackoverflow.com/questions/14891977/%url%">here</a> to continue

Although translations and design should be kept separated there are always some situations that you must use html tags inside translation files as it is also seen in huge projects like Facebook and Twitter.

In such situations, you can use XLIFF format which is being recommended by Symfony. Inside translation file:

<trans-unit id="1">
   <source>confirmed</source>
   <target>Congrats <![CDATA[<span class="bold">%username%</span>]]> , your account is now activated.</target>
</trans-unit>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)