array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'es', ), 'this' => array ( 0 => 'function.ngettext.php', 1 => 'ngettext', ), 'up' => array ( 0 => 'ref.gettext.php', 1 => 'Funciones de Gettext', ), 'prev' => array ( 0 => 'function.gettext.php', 1 => 'gettext', ), 'next' => array ( 0 => 'function.textdomain.php', 1 => 'textdomain', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'es', 'path' => 'reference/gettext/functions/ngettext.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
ngettext — Versión plural de gettext
La versión plural de gettext(). En algunos idiomas se tiene más de una forma para el mensaje en plural dependiendo de la cantidad.
msgid1
msgid2
n
Devuelve la correcta forma plural del mensaje identificados por
mensaje1
y mensaje2
para el conteo en n
.
Ejemplo #1 Ejemplo de ngettext()
<?php
setlocale(LC_ALL, 'cs_CZ');
printf(ngettext("%d ventana", "%d ventanas", 1), 1); // 1 okno
printf(ngettext("%d ventana", "%d ventanas", 2), 2); // 2 okna
printf(ngettext("%d ventana", "%d ventanas", 5), 5); // 5 oken
?>