Expand my Community achievements bar.

HTL Formatting with HTML tags inside is not working

Avatar

Level 3

Hi

 

I have a problem with the formatiing in HTL strings..... In my case this works:

<p>${"For more details see <b>Sale Conditions</b> and <b>Cats Terms and Conditions</b>" @ i18n, context='html'}</p>

and this works

${"For more details see {0} and {1}" @ i18n, context='html', format = ['Sale Conditions','Cats Terms and Conditions']}

but this one:

${"For more details see {0} and {1}" @ i18n, context='html',format = ['<b>Sale Conditions</b>','<b>Cats Terms and Conditions</b>']}

doesn't works!!!!! I getting this error :

<h1>Error during include of component '/apps/dog/components/cat'</h1><h3>Error Message:</h3>
<pre>org.apache.sling.api.scripting.ScriptEvaluationException: org.apache.sling.scripting.sightly.SightlyException: org.apache.sling.api.scripting.ScriptEvaluationException: org.apache.sling.scripting.sightly.SightlyException: Parsing error in template /apps/dog/components/cat.html at line 27: token recognition error at: '&quot;' for expression ${&quot;For more details see {0} and {1} . &quot; @ i18n, context='html', format = [&quot;</pre><h3>Processing Info:</h3>
<table style='font-family: monospace'>
<tr><td>Page</td><td>=</td><td>/content/trp/en/<td></tr><tr><td>Resource Path</td><td>=</td><td>/content/en/jcr:content/responsivegrid/<td></tr><tr><td>Cell</td><td>=</td><td>checkout-traveller-list-review<td></tr><tr><td>Cell Search Path</td><td>=</td><td>contentpage|page/responsivegrid/<td></tr><tr><td>Component Path</td><td>=</td><td>/apps/td></tr></table>
<h3>Sling Request Progress:</h3>
<pre>


Somebody help me!!!!

 

Thanks

5 Replies

Avatar

Level 3

Thanks smacdonald2008

I already spent a full day reading the specifications....

And no luck .....

Avatar

Level 10

Why not use:

<p>${"For more details see <b>Sale Conditions</b> and <b>Cats Terms and Conditions</b>" @ i18n, context='html'}</p>

Avatar

Level 3

Hi

Because the translation is not working with HTML tags inside (it's just show me the same English content never the Spanish one) .... and it will be hard for final users (content and translators) to edit HTML tags in theirs phrases ..... 

Thanks once again!!!!

Avatar

Level 1

Hi smacdonald2008,

                     

I am using the below code for translate the English to other language through i18n

1 > ${"{0}" @i18n, format=[properties.questionAnswer],context='html'}

2 > ${properties.questionAnswer @ i18n, context='html'}

But this is not working for me.

 

When i am using the below code it is working fine for me
${"Hello World" @ i18n, context='html'}

So is there any way to use the i18n for RTE (Rich Text ).