ZF-3749: Zend_Translate with the gettext adapter returns an unexpected result when called with an empty string

Issue Type: Bug Created: 2008-07-24T16:33:00.000+0000 Last Updated: 2008-09-02T10:39:09.000+0000 Status: Resolved Fix version(s): - 1.6.0 (02/Sep/08)

Reporter: Jean-Philippe Côté (jpcote) Assignee: Thomas Weidner (thomas) Tags: - Zend_Form

Related issues: Attachments:


When Zend_Translate (used with the gettext adapter) is fed an empty string, it returns a long string of header file information (see ZF-2914). This is the normal behaviour.

However, when Zend_Form uses Zend_Translate in a similar context, the output is not appropriate.

For example, if I have a list for which I want the first entry to be empty (so there is no default selection made), the label of that first entry (an empty string) is being translated by the gettext adapter to the string of system info. This is obviously not what I want.


<pre class="literal">$form->birthYear->addMultiOption('', '');


$form->birthYear->addMultiOption(null, null);

Will output something like

<pre class="literal">Project-Id-Version: removed
POT-Creation-Date: 2008-07-23 22:23-0500
Last-Translator: removed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Poedit-Language: English
X-Poedit-Country: CANADA
X-Poedit-SourceCharset: utf-8
X-Poedit-KeywordsList: translate
X-Poedit-Basepath: removed
X-Poedit-SearchPath-0: removed

I believe this behaviour, which has been corrected for fieldset labels (ZF-2913), should also be corrected for field labels.

Thank you.


Posted by Matthew Weier O'Phinney (matthew) on 2008-07-24T19:46:20.000+0000

Assigning to Thomas.

Posted by Thomas Weidner (thomas) on 2008-07-28T12:44:23.000+0000

For your information: This is not a bug of Zend_Translate.

When gettext files are compiled with poEdit the editor adds it's own information as translation of an empty string. ALL translations are used and returned, of course also an empty translation.

So the general question is:

Do we want to suppress the informations when they are provided ? Or do we change Zend_Form to "not translate" empty strings.

Suppressing the informations raise another possible problems... other editors could add such information in a different translation. As mentioned this is a poEdit ONLY problem which adds this information as translation for an empty string.

Posted by Matthew Weier O'Phinney (matthew) on 2008-07-28T12:51:03.000+0000

As Thomas notes, this is not a bug in Zend_Translate, and Zend_Translate is only doing Zend_Form's bidding; ultimately, it's a poEdit issue.

I'm closing this, as there's no reasonable solution on the framework side.

Posted by Thomas Weidner (thomas) on 2008-07-28T13:40:04.000+0000

New feature implemented with r10517.

Empty translations are now suppressed by the gettext adapter. Adapter informations can be retrieved with the new 'getAdapterInfo()' method.

Posted by Wil Sinclair (wil) on 2008-09-02T10:39:09.000+0000

Updating for the 1.6.0 release.

Have you found an issue?

See the Overview section for more details.


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

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