ZF-12426: Zend_Translate Adapter Gettext
Description
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): "http://zend-framework-community.634137.n4.nabble.com/Translating-messages-with-context-td1593226.html"
A solution without "msgctxt": Check "http://www.gnu.org/software/gettext/manual/gettext.html#xgettext-Invocation" -> "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.
--<--
Comments
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: https://github.com/zendframework/zf1/issues/20