zendframework / zend-i18n

I18n component from Zend Framework
BSD 3-Clause "New" or "Revised" License
65 stars 49 forks source link

Zend\I18n\Translator\TextDomain storage - whitespace in key #53

Closed ma-si closed 7 years ago

ma-si commented 8 years ago

Translation with text_domain not working for gettext.

In second example key is uiname with whitespace.

Case working:

PoEdit Source keywords: translate:1 translatePlural:1,2

$this->translatePlural('name', 'names', 1, 'ui') TextDomain storage gives: ["storage":"ArrayObject":private]=> array(2) { ["name"]=> array(3) { [0]=> string(5) "imiÄ™" [1]=> string(6) "imiona" [2]=> string(5) "imion" } ["names"]=> string(0) "" }

Case not working:

PoEdit Source keywords: translate:1,2c translatePlural:1,2,4c

This is configuration to update only defined text_domain from source code. PoEdit works well

$this->translatePlural('name', 'names', 1, 'ui') TextDomain storage gives: ["storage":"ArrayObject":private]=> array(2) { ["uiname"]=> array(3) { [0]=> string(5) "imiÄ™" [1]=> string(6) "imiona" [2]=> string(5) "imion" } ["names"]=> string(0) "" }

In .po file there is one difference: msgctxt "ui" msgid "name" msgid_plural "names" msgstr[0] "imię" msgstr[1] "imiona" msgstr[2] "imion"

ma-si commented 7 years ago

\x04 EOT in storage array key

["storage":"ArrayObject":private]=> array(2) { ["ui\x04name"]=> array(3) { [0]=> string(5) "imię" [1]=> string(6) "imiona" [2]=> string(5) "imion" } ["names"]=> string(0) "" }