关于Magento中的translate ="label"属性,它是如何工作的?

vie*_*ean 11 magento

我在config.xml文件中看到了.我知道那个<template>块,这就是阻止电子邮件模板的块,并且translate存在的属性将在locale文件夹中翻译.但我不知道究竟是什么,它是如何工作的?

translate ="label",它是如何工作的?

<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>
Run Code Online (Sandbox Code Playgroud)

Ala*_*orm 28

当你看到时translate="label" module="customer",这告诉Magento它应该通过客户模块的数据助手的translate方法传递<label>标签中的值,然后再将其显示到屏幕上.用简单的术语来说

$label_value = (string) $node->label;
echo Mage::helper('customer')->__($label_value);
Run Code Online (Sandbox Code Playgroud)

如果module属性不存在,core则使用该模块.您可以使用空格分隔的字符串指定要翻译的多个标记.

translate="label type"  
Run Code Online (Sandbox Code Playgroud)

据我所知,系统配置部分和布局xml <action>节点(用于翻译参数)仅支持此功能.

  • 非常喜欢这个答案. (5认同)