ZF-12426: Zend_Translate Adapter Gettext


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

$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:

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

example of po file:

msgctxt "coredomain"
msgid "Invalid class name \"%1$s\""
msgstr "Ungueltiger Klassenname \"%1$s\""

printr shows:

[_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: -->--

For PHP: _, gettext, dgettext:2, dcgettext:2, ngettext:1,2, dngettext:2,3, dcngettext:2,3. 



Code tags added.

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

@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

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