#19274 [Opn->Fbk]: gettext doesn't translate if using printf formatted strings
| From: | kalowsky@php.net | Date: | Sun, 08 Sep 2002 02:11:57 +0000 |
| Subject: | #19274 [Opn->Fbk]: gettext doesn't translate if using printf formatted strings | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-18651@lists.php.net to get a copy of this message | ||
ID: 19274
Updated by: kalowsky@php.net
Reported By: bostjan.zoks@uni-mb.si
-Status: Open
+Status: Feedback
Bug Type: Gettext related
Operating System: Windows XP
PHP Version: 4.2.3
New Comment:
just a typical hack question...
does
$string = _("my string goes here %s");
printf("$string", 2);
or something simliar to that work?
Previous Comments:
------------------------------------------------------------------------
[2002-09-07 05:51:13] bostjan.zoks@uni-mb.si
If using standard strings, gettext correctly uses translated string.
If using formatted strings (those that can be used for printf, like "my
name is %s and I'm %d years old"), it leaves string in original
language.
Short example:
--- from test.php ---
print (_("how are you?"));
print "<br>";
printf (_("and now, when asking %d nd time?"), 2);
--- from i18n.po ---
#: test.php:6
msgid "how are you?"
msgstr "kak si kaj?"
#: test.php:8
#, c-format
msgid "and now, when asking %d nd time?"
msgstr "in sedaj, ko sprasujem %d .?"
--- output from this script ---
kak si kaj?
and now, when asking 2 nd time?
-------
I'm using PHP4.2.3 as apache1.3.26 module on WinXP.
Regards,
Bostjan
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19274&edit=1