Zend Framework

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

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Not an Issue
  • Affects Version/s: 1.9.3
  • Fix Version/s: 1.9.4
  • Component/s: Zend_Translate, Zend_View
  • Labels:
    None

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') ?>

Activity

Hide
Thomas Weidner added a comment -

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

Show
Thomas Weidner added a comment - This is a simple configuration issue of poEdit and not one of ZF. Tell your parser to search for translate( additionally to _(.
Hide
Robbert Korving added a comment -

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.

Show
Robbert Korving added a comment - 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.
Hide
Thomas Weidner added a comment -

Closing as non-issue

Show
Thomas Weidner added a comment - Closing as non-issue

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: