Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

About translate="label" attribute in Magento, how does it work?

Tags:

magento

I see in a config.xml file. I know that <template> block and this is the block hold the email template, and translate attribute which is present will be translate in the locale folder. But I don't know what is it exactly, and how does it work?

translate="label", how does it work?

<template>
    <email>        
        <customer_active_account_email_template translate="label" module="customer">
            <label>Active Customer</label>
            <file>customer_active.html</file>
            <type>html</type>
        </customer_active_account_email_template>
    </email>
</template>
like image 670
vietean Avatar asked Sep 26 '11 03:09

vietean


1 Answers

When you see translate="label" module="customer", this tells Magento that it should pass the value in the <label> tag through the customer module's data helper's translate method before displaying it to the screen. In over simplified terms

$label_value = (string) $node->label;
echo Mage::helper('customer')->__($label_value);

If the module attribute is not present, the core module is used. You may specify multiple tags to be translated with a space delimited string.

translate="label type"  

As far as I know, this is supported in the System Configuration section, and the layout xml <action> nodes (for translating paramaters) only.

like image 131
Alan Storm Avatar answered Nov 18 '22 05:11

Alan Storm