Question

I have a question about translation in block classes. In phtml files, $this->__() (A) is used to translate (or at least most commonly that I've seen). In Mage block classes, Mage::helper('helpername')->__() (B) is commonly used, but I've seen people use $this->__() in block classes, as well.

Whether it's Mage_Core_Block_Abstract::__() or Mage_Core_Helper_Abstract::__(), it doesn't effectivelty matter for now, as they are identical functions (EE 1.13).

Question 1

But which is more proper? I understand that this could be somewhat opinion-based, but to be more future-resistant, I would think using the helper is more proper.

Question 2

Is there a particular reason the functions defined in block classes use the helper's method, whereas the template uses the block's method?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top