Using html after text saved in DB by translate method

LiteCart Fan
De Sweden
Miembro desde 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
De United States
Miembro desde 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
De Sweden
Miembro desde may. 2013
tim

You need to enable HTML for the translation key.

LiteCart Fan
De Sweden
Miembro desde oct. 2021

it's 2.4.4 on me, it worked. 

Thank you guys.

Este hilo se ha cerrado debido a una larga inactividad. No es posible publicar en él.
This website uses no cookies and no third party tracking technology. We think we can do better than others and really think about your privacy.