How I can translate this text in a php file, I want to translate $message
if (!$this->_getSession()->getNoCartRedirect(true)) {
if (!$cart->getQuote()->getHasError()) {
$notifysymbol = "<img src='".Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)."/noticeicons/1489953827_warning.png' >";
$message = $this->__('<div class="notit"><span class="notification-symbol">%s</span><div class="rowt2"> <span class="added_cart">Product added to cart</span><br/><span class="small-text"> Go to the checkout to complete your purchase or add more products</span></div></div>',$notifysymbol);
$this->_getSession()->addSuccess($message);
}
$this->_goBack();
}
and this is the text in the Custom field:
<div class="notit"><span class="notification-symbol">%s</span><div class="rowt2"> <span class="added_cart">Product added to cart</span><br/><span class="small-text"> Go to the checkout to complete your purchase or add more products</span></div></div>
The text is the core_translate table too
Best Answer
The
$message
is already translatable, because you use$this->__()
to generate it. So, you can enable Inline Translation to translate it.However, it is not best practise to use HTML code inside a translatable string. Imagine you string will some time be changed by your client - this will surely result in errors when HTML code needs to be changed. I would suggest the following solution: