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:

/app/code/core/Mage/Core/Model/Translate/Inline.php

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 = ''.$m[2][0].'';

$this->_content = substr_replace($this->_content, $spanHtml, $m[0][1], strlen($m[0][0]));
$next = $m[0][1];
}

}

Trickty Part

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

Example:

__('Customers'); ?>

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 😉

About Rick

Senior Front-end Software Engineer from Barcelona, Haidong Gumdo Instructor (korean martial art of the sword), street photographer, travel lover, TV addict, Boston Red Sox fan, and privacy advocate.

Leave a Reply

Add <code> Some Code </code> by using this tags.

*
*