7

Maybe it's just me, but in Chrome browser inline translate does not work. The red boxes are shown and if I hover the mouse the book icon appears but if I click it nothing happens. I had the same problem on different servers.

Other browser like Firefox and IE are fine.

Is there a bugfix for this?

  • what do you mean by 'doesn't work'? It does not appear, it does not save, do you get js errors? – Marius Aug 6 '13 at 14:12
11

Yes, the inline translation feature is broken in Google Chrome. Back when the inline translation feature was originally developed, Magento made use of a non-standard translate attribute in DOM elements to flag translatable text.

Since then, Google Chrome has a feature where a default translate property is added to every DOM node available in javascript (over simplification).

This, in turn, interfers with Magento's PrototypeJS xpath code used to implement the translation feature. Specifically, this

if (!$(target).match('*[translate]')) {
    target = target.up('*[translate]');
}

I solution I came up with last year was to add the following bit of javascript to every page when inline translations are active.

if(Object.__defineGetter__)
{
    var hasTranslateAttribute = function(){
        return $(this).hasAttribute("translate");
    };
    document.observe("dom:loaded", function() {
        $$('*').each(function(theElement){
             theElement.__defineGetter__("translate", hasTranslateAttribute);
        });
    });
}
  • It's still an issue. But the line that's the problem is a couple down from that and I changed it like so: //if (target && $(target).match('*[translate]')) { if (target && $(target).readAttribute('translate')) { – phazei Jul 17 '14 at 4:45
5

For Enterprise customers, there is a Magento core patch available (SUPEE-1373) which was tested by us and works.

It basically replaces all the translate properties by data-translate across the code.

  • Is it just me or has this "SUPEE-1373" patch just vanished of the internet? google.com/… – 7ochem Mar 10 '15 at 15:10
  • @7ochem: The patch is only available via Magento Enterprise support. Unfortunately they did not fix it in CE 1.9 even the patch was available before the release of CE 1.9 – Alex Mar 11 '15 at 15:58
  • I've gone though the whole file list in my EE technical resources, but I can't find it... – 7ochem Mar 11 '15 at 16:18
  • Just open a support request and ask for the patch. – Alex Mar 12 '15 at 12:39
-1

The solution provided by Alan Storm works. To make it work across the entire site, just add the snippet to /app/code/core/Mage/Core/Model/Translate/Inline.php, right after

<script type="text/javascript">
new TranslateInline('translate-inline-trig', '<?php echo $ajaxUrl ?>', '<?php
    echo Mage::getDesign()->getArea() ?>');

That's line 278 in 1.7.

  • 3
    Really? Core change? At the very least, suggest that user use Magento's rewrites. There are other ways to effect this change without a rewrite. – benmarks Aug 19 '13 at 11:37
  • I added it into the javascript file of my template. – PiTheNumber Aug 19 '13 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.