Stratboy Stratboy - 16 days ago 6
Smarty Question

how to use html tags in prestashop's smarty translations?

I can't find a solution. What I've got to do is translate this:

se stai inserendo un indirizzo per consegna all'interno dell'area <span class=orange>EXPO</span>


into this:

If your delivery address is in the <span class=orange>EXPO</span> area


If I use tags, like this:

{l s="se stai inserendo un indirizzo per consegna all'interno dell'area <span class=orange>EXPO</span>"}


They won't be seen. So what?

Answer

The translation function will remove all html tags so you will have to use an alternative like so

{capture "string"}
  {l s="se stai inserendo un indirizzo per consegna all'interno dell'area _h1_EXPO_h2_"}
{/capture}
{$smarty.capture.string|replace:'_h1_':'<span class="orange">'|replace:'_h2_':'</span>'}

_h1_ and _h2_ are in the translation and they are replaced by <span class="orange"> and </span> respectively

The smarty capture function is used to get the translation into the variable string instead of dispaying it

So your English translation would be something like this
If your delivery address is in the _h1_EXPO_h2_ area

Comments