Bug #67423 [Opn->Nab]: ngettext() returns po file headers when first param is an empty string
| From: | santiagolizardo@php.net | Date: | Mon, 11 Aug 2014 21:31:44 +0000 |
| Subject: | Bug #67423 [Opn->Nab]: ngettext() returns po file headers when first param is an empty string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187083@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67423&edit=1
ID: 67423
Updated by: santiagolizardo@php.net
Reported by: phil at propcom dot co dot uk
Summary: ngettext() returns po file headers when first param
is an empty string
-Status: Open
+Status: Not a bug
Type: Bug
Package: Gettext related
Operating System: Centos
PHP Version: 5.4.29
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Despite being a bit confusing, that's what the gettext library is supposed to be returning when
you give an empty string for translation.
If you are curious about the reason, please read the MO format section of gettext from its official
website:
http://www.gnu.org/software/gettext/manual/gettext.html#MO-Files
"Having the original strings sorted enables the use of simple binary search, for when the MO
file does not contain an hashing table, or for when it is not practical to use the hashing table
provided in the MO file. This also has another advantage, as the empty string in a PO file GNU
gettext is usually translated into some system information attached to that particular MO file, and
the empty string necessarily becomes the first in both the original and translated tables, making
the system information very easy to find."
Previous Comments:
------------------------------------------------------------------------
[2014-06-11 21:16:08] phil at propcom dot co dot uk
Description:
------------
When ngettext is called with an empty string as the first parameter, it returns the unparsed headers
from the PO (or indeed MO) file.
Test script:
---------------
https://gist.github.com/phil-lavin/ac3e3c20fd0e902f6f88
Expected result:
----------------
1 Produkt
<no output>
Actual result:
--------------
As per Gist
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67423&edit=1