Using html after text saved in DB by translate method

LiteCart Fan
Van Sweden
Lid sinds okt. 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
Van United States
Lid sinds okt. 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
Van Sweden
Lid sinds mei 2013
tim

You need to enable HTML for the translation key.

LiteCart Fan
Van Sweden
Lid sinds okt. 2021

it's 2.4.4 on me, it worked. 

Thank you guys.

Dit topic is gesloten wegens langdurige inactiviteit. Erop posten is niet mogelijk.
Deze website maakt geen gebruik van cookies en geen trackingtechnologie van derden . Wij denken dat we het beter kunnen dan anderen en hechten veel waarde aan uw privacy.