ngettext
(PHP 4 >= 4.2.0, PHP 5, PHP 7)
ngettext — Plural version of gettext
Descrierea
ngettext
( string $singular
, string $plural
, int $count
) : string
Parametri
-
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.
Valorile întoarse
Returns correct plural form of message identified by
singular and plural
for count count.
Exemple
Example #1 ngettext() example
<?php
setlocale(LC_ALL, 'cs_CZ');
printf(ngettext("%d window", "%d windows", 1), 1); // 1 okno
printf(ngettext("%d window", "%d windows", 2), 2); // 2 okna
printf(ngettext("%d window", "%d windows", 5), 5); // 5 oken
?>