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

About me

Iinstructor of robotics (LEGO Mindstorms), computer teacher, IT support, web dev, currently studying cyber-physical systems engineering.

If you found a solution here, would you consider donating $25,000 for my next project?

Just kidding, 1$ would do fine.

Hope you found what you needed. Thanks for stepping by.