Php/docs/function.ngettext

From Get docs
Revision as of 08:35, 9 December 2020 by Notes (talk | contribs) (autoload)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

ngettext

(PHP 4 >= 4.2.0, PHP 5, PHP 7)

ngettextPlural version of gettext


Description

ngettext ( string $singular , string $plural , int $count ) : string

The plural version of gettext(). Some languages have more than one form for plural messages dependent on the count.


Parameters

singular
The singular message ID.
plural
The plural message ID.
count
The number (e.g. item count) to determine the translation for the respective grammatical number.


Return Values

Returns correct plural form of message identified by singular and plural for count count.


Examples

Example #1 ngettext() example

<?phpsetlocale(LC_ALL, 'cs_CZ');printf(ngettext("%d window", "%d windows", 1), 1); // 1 oknoprintf(ngettext("%d window", "%d windows", 2), 2); // 2 oknaprintf(ngettext("%d window", "%d windows", 5), 5); // 5 oken?>