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

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

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 Exponential 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