Forums / Setup & design / how to use HTML tags in translation?

how to use HTML tags in translation?

Author Message

Marko Žmak

Saturday 06 February 2010 4:01:58 pm

I would like to use some HTML tags in translation source in translation.ts. For example, something like this:

<message>
 <source>Fields marked with <span>*</span> are mandatory</source>
 <translation>Fields marked with <span>*</span> are mandatory</translation>

is this possible and how?

Because when I put just <span> like in this example, the translation file doesn't validate. Is there some way to escape "<" and ">" characters?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Gaetano Giunta

Sunday 07 February 2010 7:40:23 am

use &lt; and &gt;

nb: I generally think this is a VERY bad idea, as you are preventing the translation from usage in non-html mode (eg. emails or xml output), and hardcoding some design into it. You should rather split your phrases in smaller parts...

Principal Consultant International Business
Member of the Community Project Board

Łukasz Serwatka

Monday 08 February 2010 2:42:12 am

Here is a proper eZ Publish way example:

{'Fields marked with %open_tag*%close_tag are mandatory'|i18n('design/custom/context', ,hash('%open_tag', '<span>', '%close_tag', '</span>'))}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog