Using html after text saved in DB by translate method

LiteCart Fan
Depuis Sweden
Membre depuis oct. 2021

Hi there
I try to use HTML in this $message, everything is ok without the translation method. When I use
language::translate()
method after $message. I will receive only text, all HTML codes have gone inside the text.


     $css = file_get_contents(FS_DIR_TEMPLATE . 'css/email_template.css');
     $message = "<html><head><style>".$css."</style></head><body>
     <div class='email-main'>
     <div class='email-date'>".date('h:i - m, d, Y')."</div>
     <div class='email-message'>
       <div class='email-header'>
         <a href='#'><img src='".$url."/images/email_header.jpeg' class='email-header-bg'></a>
       </div>
       <div class='email-text'>
        <p style='color: black;'>Thank you for your purchase!</p></br></br>
        <p>Your order #%order_id has successfully been created with a total of %payment_due for the following ordered items:</p></br></br>
        <p>%order_items</p></br></br>
        <p>A printable order copy is available here:</p></br>
        <p>%order_copy_url</p></br>
        <p>Regards,</p></br>
        <p>%store_name</p></br>
        <p>%store_url</p></br>
       </div>
       <div class='email-footer'>
        <a href='#'><img src='".$url."/images/email_footer.jpeg' class='email-footer-bg'></a>
       </div>
     </div>
     </body></html>";

      $message = strtr(language::translate('email_order_confirmation', $message, $language_code), $aliases);```

Is there a any solution for this problem ?
Moderator
Depuis United States
Membre depuis oct. 2019

I just tested it under 2.5.2 and it works for me.  Which version are you using?

I just thought of something.  Perhaps you already have a translation named "email_order_confirmation"?  If so, LiteCart won't overwrite it — you'll need to delete it first in the admin.  Once you do that, it should be saved properly.

tim
Founder
Depuis Sweden
Membre depuis mai 2013
tim

You need to enable HTML for the translation key.

LiteCart Fan
Depuis Sweden
Membre depuis oct. 2021

it's 2.4.4 on me, it worked. 

Thank you guys.

Ce fil de discussion a été fermé en raison d'une longue inactivité. Il n'est pas possible de publier dessus.
Ce site n'utilise aucun cookie ni aucune technologie de suivi tierce. Nous pensons pouvoir faire mieux que les autres et nous nous soucions vraiment de votre vie privée.