note 55365 deleted from function.ngettext by nlopess

From: Date: Fri, 02 Sep 2005 10:39:51 +0000
Subject: note 55365 deleted from function.ngettext by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-94654@lists.php.net to get a copy of this message
Note Submitter: tfpsky - yahoo com br ---- You can use it to get plural translations: in PO file (tranlation from en_US to pt_BR): msgid "%d object" msgid_plural "%d objects" msgstr[0] "%d objeto" msgstr[1] "%d objetos" in you PHP, something like this: <?php $translationString = ngettext("%d object", "%d objects", $number); printf( $translationString, $number ); ?> It will decide what to use, acording to $number: in this case, if $number == 1, ngettext returns the first message ("%d object"). Else, it returns the second message ("%d objects"). Thanks to http://maconlinux.net/php-online-manual/en/function.ngettext.html :D Thiago F Pappacena

« previous php.notes (#94654) next »