# ngettext(3) - man - phpMan

[NGETTEXT(3)](https://www.chedong.com/phpMan.php/man/NGETTEXT/3/markdown)                           Library Functions Manual                           [NGETTEXT(3)](https://www.chedong.com/phpMan.php/man/NGETTEXT/3/markdown)



## NAME
       ngettext, dngettext, dcngettext - translate message and choose plural form

## SYNOPSIS
### #include <libintl.h>

       **char** ***** **ngettext** **(const** **char** ***** _msgid_**,** **const** **char** ***** _msgid_plural_**,**
                        **unsigned** **long** **int** _n_**);**
       **char** ***** **dngettext** **(const** **char** ***** _domainname_**,**
                         **const** **char** ***** _msgid_**,** **const** **char** ***** _msgid_plural_**,**
                         **unsigned** **long** **int** _n_**);**
       **char** ***** **dcngettext** **(const** **char** ***** _domainname_**,**
                          **const** **char** ***** _msgid_**,** **const** **char** ***** _msgid_plural_**,**
                          **unsigned** **long** **int** _n_**,** **int** _category_**);**

## DESCRIPTION
       The  **ngettext**, **dngettext** and **dcngettext** functions attempt to translate a text string into the
       user's native language, by looking up the appropriate plural form of  the  translation  in  a
       message catalog.

       Plural  forms  are  grammatical  variants  depending on the a number. Some languages have two
       forms, called singular and plural. Other languages have three forms,  called  singular,  dual
       and plural. There are also languages with four forms.

       The  **ngettext**,  **dngettext** and **dcngettext** functions work like the **gettext**, **dgettext** and **dcget**‐‐
       **text** functions, respectively.  Additionally, they choose the appropriate plural  form,  which
       depends  on  the  number  _n_ and the language of the message catalog where the translation was
       found.

       In the "C" locale, or if none of the used catalogs contain a translation for _msgid_, the **nget**‐‐
       **text**, **dngettext** and **dcngettext** functions return _msgid_ if _n_ == 1, or _msgid_plural_ if _n_ != 1.

## RETURN VALUE
       If  a  translation was found in one of the specified catalogs, the appropriate plural form is
       converted to the locale's codeset and returned. The resulting string is statically  allocated
       and  must not be modified or freed. Otherwise _msgid_ or _msgid_plural_ is returned, as described
       above.

## ERRORS
       **errno** is not modified.

## BUGS
       The return type ought to be **const** **char** *****, but is **char** ***** to avoid warnings in C code predating
       ANSI C.

## SEE ALSO
       [**gettext**(3)](https://www.chedong.com/phpMan.php/man/gettext/3/markdown), [**dgettext**(3)](https://www.chedong.com/phpMan.php/man/dgettext/3/markdown), [**dcgettext**(3)](https://www.chedong.com/phpMan.php/man/dcgettext/3/markdown)



GNU gettext 0.20.1.124-32cf                   May 2001                                   [NGETTEXT(3)](https://www.chedong.com/phpMan.php/man/NGETTEXT/3/markdown)
