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

Issue Type: Improvement Created: 2009-09-22T08:31:10.000+0000 Last Updated: 2009-09-22T12:29:19.000+0000 Status: Resolved Fix version(s): - 1.9.4 (13/Oct/09)

Reporter: Robbert Korving (kweek) Assignee: Thomas Weidner (thomas) Tags: - Zend_Translate

  • Zend_View

Related issues: Attachments:



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

<pre class="highlight"> 
$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:

<pre class="highlight"> 
<?= $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:

<pre class="highlight"> 
<?= $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:

<pre class="highlight"> 
<?= $this->translate->_('Translate this') ?>


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

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.