在Magento中调用帮助器的正确方式是以下哪种:
Mage::helper('helper_class)->__('String to be translated);V
$this->__('String to be translated);发布于 2012-11-24 03:03:07
两个都是!
这真的取决于你在哪里调用它,以及你的翻译位于哪里。
让我们来看看它们。首先是这一条:
$this->__('String to be translated);如果在helper类内部调用它,它将返回此helper所属模块的翻译。否则,它将返回核心Magento翻译。
Mage::helper('helper_class)->__('String to be translated);在所有其他情况下,必须使用此代码来获得特定模块的翻译。
https://stackoverflow.com/questions/13534517
复制相似问题