ZF-12426: Zend_Translate Adapter Gettext

Issue Type: Bug Created: 2012-09-25T11:27:31.000+0000 Last Updated: 2013-04-05T16:07:15.000+0000 Status: Closed Fix version(s): Reporter: Florian Blasel (flobee) Assignee: None Tags: - Zend_Translate

Related issues: Attachments:


Hi When using domain translation, translation will not work because translation string are not found when using e.g.:

<pre class="highlight">
$l->_d('myDomain', 'translate me');

The reason seems to be in the parser of the *.mo files in Zend_Translate_Adapter_Gettext.

Using poedit or xgettext to create *.mo files or:

<pre class="highlight">
xgettext --language=PHP --force-po -o /tmp/message.po --from-code=UTF-8 --keyword=_d:1c,2 some/files

example of po file:

<pre class="highlight">
msgctxt "coredomain"
msgid "Invalid class name \"%1$s\""
msgstr "Ungueltiger Klassenname \"%1$s\""

printr shows:

<pre class="highlight">
[_data:Zend_Translate_Adapter_Gettext:private] => Array
    [de_DE] => Array
        [coredomainInvalid class name "%1$s"] => Ungueltiger Klassenname "%1$s"
-------------------^ a special char as delimiter (i havent find out yet!)

An altern. description (in google with only one match): ""

A solution without "msgctxt": Check "" -> "5.1.6 Language specific options" -> "--keyword" section and update the settings in poedit: -->--

<pre class="highlight">
For PHP: _, gettext, dgettext:2, dcgettext:2, ngettext:1,2, dngettext:2,3, dcngettext:2,3. 



Posted by Frank Brückner (frosch) on 2012-09-25T11:53:09.000+0000

Code tags added.

Posted by Frank Brückner (frosch) on 2012-09-27T15:18:41.000+0000

@Florian {quote}``` What is $l and what is _d()?

Posted by Florian Blasel (flobee) on 2012-09-27T19:59:59.000+0000

@Frank $l = translate object in this case: Zend_Translate_Adapter_Gettext _d = own inplementation (a wrapper) for "domain translate"

i already using the reported alternativ way but its not good that the gettext adapter has problems when msgctxt tags (or other probably) in the po files. In my oppinion: that's a bug

Kind regards Florian

Posted by Ralph Schindler (ralph) on 2013-04-05T16:07:15.000+0000

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit:

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.