eZ Community » Forums » Setup & design » how to use HTML tags in translation?
expandshrink

how to use HTML tags in translation?

how to use HTML tags in translation?

Sunday 07 February 2010 1:01:58 am - 2 replies

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?

Modified on Sunday 07 February 2010 1:02:24 am by Mavko Žmak - Žmale

Sunday 07 February 2010 4:40:23 pm

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

Monday 08 February 2010 11: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>'))}

Modified on Monday 08 February 2010 11:42:37 am by Łukasz Serwatka

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from