2

I have something like this in list.phtml __('Add to Wishlist') ?> and I want to know which constructor and which PHP class file is it calling for ?

1
  • Constructors in PHP are __constructor. __ is a normal method! And be careful, magento introduces _constructor (one _), this is a "normal" method too, but called by the __constructor :-) Commented Aug 19, 2013 at 8:33

1 Answer 1

2

The block classes are extended from the Mage_Core_Block_Abstract, in this class the function __() calls the translator to translate the supplied text:

/**
     * Translate block sentence
     *
     * @return string
     */
    public function __()
    {
        $args = func_get_args();
        $expr = new Mage_Core_Model_Translate_Expr(array_shift($args), $this->getModuleName());
        array_unshift($args, $expr);
        return Mage::app()->getTranslator()->translate($args);
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.