Solved: Magento Inline translation not working in Chrome

Tried to use inline translation for frontend in Magento. Didn’t work. The icons appeared, but clicking them didn’t have any effect. 

How to make inline translation to work in Google Chrome browser? 

1. Navigate to \app\code\core\Mage\Core\Model\Translate\Inline.php

2. Row 272, find this code:

<script type=”text/javascript”>

    new TranslateInline(‘translate-inline-trig’, ‘<?php echo $ajaxUrl ?>’, ‘<?php

        echo Mage::getDesign()->getArea() ?>’);

</script>

3. Replace it with this code: 

<script type=”text/javascript”>

    new TranslateInline(‘translate-inline-trig’, ‘<?php echo $ajaxUrl ?>’, ‘<?php

        echo Mage::getDesign()->getArea() ?>’);

 

if(Object.__defineGetter__)

{

    var hasTranslateAttribute = function(){

        return $(this).hasAttribute(“translate”);

    };

    document.observe(“dom:loaded”, function() {

        $$(‘*’).each(function(theElement){

             theElement.__defineGetter__(“translate”, hasTranslateAttribute);

        });

    });

}

</script>

4. Save and refresh, enjoy. 

 

Yes, it is generally not a good idea to edit core files, but hey, once you have translated all the shop, maybe it won’t matter that future updates might override your core edits and you lose the Chrome inline translation option. 

The Magento version I ran this edit on was 1.9.0.1

Post Author: Tom Pai