ZF-7921: Let Zend_View_Helper_Translate translate in the same way as Zend_Translate so that it gets picked up by poedit (gettext)



I noticed that I can use Zend_Translate set via Zend_Application_Resource_Translate in an action controller like this:

$translate = Zend_Registry::get('Zend_Translate');
$translate->_('Translate this');

The _('Translate this') is getting picked up by poedit.

Now in a view script with the Zend_View_Helper_Translate according to the manual translating should look like this:

<?= $this->translate('Translate this') ?>

But this doesn't get picked up by poedit because it doesn't have _('Translate this').

I got it working like this:

<?= $this->translate()->getTranslator()->_('Translate this') ?>

I think it would be easier and neater if the Zend_View_Helper_Translate could be used in the same way as Zend_Translate. Something like this:

<?= $this->translate->_('Translate this') ?>


This is a simple configuration issue of poEdit and not one of ZF. Tell your parser to search for translate( additionally to _(.

Your right, I didn't think of it that way. I added the key word "translate" to the parser and now it also indexes translatable strings that uses the translate view helper in a view script.

Thanks for your response.

Closing as non-issue