Search code examples
phpmagentotranslationcustomizationenterprise

How to make custom text use the Inline Translation tool in Magento Enterprise


I've created a piece of text in a Magento Template, and the inline translation tool is turned on and working fine, but when I visit the page with my custom text, it seems to ignore that it's translatable (no book icon and dotted red border).

So here's what I have (approx):

<div class="foo">
    <?php echo $this->__('My custom Text'); ?>
</div>

Which renders fine, and if I edit the relevant CSV file, it changes appropriately.

Is there any way to "add" this to the translation tool's eyeline?

Thanks in advance!


Solution

  • OK, Managed to find the problem - so for anybody that wants to use the inline translation stuff, do:

    <div class="foo">
        <span>
            <?php echo $this->__('My custom Text'); ?>
        </span>
    </div>
    

    There's a list of allowed translatable inline tags on line #87 of app/code/core/Mage/Core/Model/Translate/Inline.php ("_allowedTagsSimple"). Enabling divs here is madness itself, but wrapping in spans should be generally quite safe.