<?php
/**
 * Helper to give Zend_View_Helper_Translate additional options
 *
 * Additions:
 *      - Translate arguments too. ($view->translate('KEY', 'arg', true);)
 *
 */
class Fiktiv_View_Helper_Translate extends Zend_View_Helper_Translate
{
    /**
     * Performs the translation
     *
     * @return string
     */
    public function translate($messageid = null)
    {
        $options = func_get_args();
        $key = array_shift($options);
        
        if (isset($options[0]) && $options[count($options)-1] === true) {
            foreach ($options as &$opt) {
                $opt = parent::translate($opt);
            }
        }

        return parent::translate($key, $options);
    }
}