Inline Translation not working Magento 1.4

Why the Inline Translation is not working?

Developing a multi lenguage site I was not able to inline translate some elements. It just didn't show the "book" button wich pops the translation window.

Half Solution

Look for:


Please notice you can create the same folder structure under the local folder and this will be not affected for the future upgrades.

Replace the _otherText() function with this one:

protected function _otherText() { if ($this->getIsJson()) { $quoteHtml = '\"'; } else { $quoteHtml = '"'; } $next = 0; while (preg_match('#('.$this->_tokenRegex.')#',$this->_content, $m, PREG_OFFSET_CAPTURE, $next)) { $tr = '{shown:\''.$this->_escape($m[2][0]).'\',' .'translated:\''.$this->_escape($m[3][0]).'\',' .'original:\''.$this->_escape($m[4][0]).'\',' .'location:\'Text\',' .'scope:\''.$this->_escape($m[5][0]).'\'}'; $spanHtml = '<span translate='.$quoteHtml.'['.$tr.']'.$quoteHtml.'>'.$m[2][0].'</span>'; $this->_content = substr_replace($this->_content, $spanHtml, $m[0][1], strlen($m[0][0])); $next = $m[0][1]; } }
Code language: PHP (php)

Trickty Part

Even doing this sometimes I can not translate some texts. When it happens I copy and paste the translate code:


<?php $this->__('Customers'); ?>
Code language: HTML, XML (xml)

I paste the code somewhere I can translate. If you translate the "Customers" string in the footer it will affect any "Customers" translation in the site.

Nasty but it works 😉

Leave a Reply

Add <code> Some Code </code> if you need to.