开发者

Translate my magento custom module in frontend

开发者 https://www.devze.com 2023-02-24 08:57 出处:网络
I have done a magento custom module and I want to make a translat开发者_JAVA百科ion for it. How can I do that, without creating another translation module ?

I have done a magento custom module and I want to make a translat开发者_JAVA百科ion for it.

How can I do that, without creating another translation module ?

Thanks a lot.


You can use built in translation methods and define all your strings in templates like this:

<?php echo $this->__('yourtext'); ?>

if you need to use strings in classes or blocks you can get the context from helper class like this:

<?php echo Mage::helper('yourextension')->__('yourtext');?>

and if you need to define your own translation file then use this in your etc/config.xml

<config>
    <frontend>
        <translate>
            <modules>
                <Your_Extension>
                    <files>
                        <default>Your_Extension.csv</default>
                    </files>
                </Your_Extension>
            </modules>
        </translate>
    </frontend>
</config>
0

精彩评论

暂无评论...
验证码 换一张
取 消