PHP.nl

ngettext

ngettext

Plural version of gettext

string **ngettext** string $singular string $plural int $count

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

singularThe singular message ID.

pluralThe plural message ID.

countThe number (e.g. item count) to determine the translation for the respective grammatical number.

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

Voorbeeld: 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

?>