ZF-7921: Let Zend_View_Helper_Translate translate in the same way as Zend_Translate so that it gets picked up by poedit (gettext)
Description
Hi,
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') ?>
Comments
Posted by Thomas Weidner (thomas) on 2009-09-22T10:09:24.000+0000
This is a simple configuration issue of poEdit and not one of ZF. Tell your parser to search for translate( additionally to _(.
Posted by Robbert Korving (kweek) on 2009-09-22T10:33:07.000+0000
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.
Posted by Thomas Weidner (thomas) on 2009-09-22T12:29:16.000+0000
Closing as non-issue