Section: C Library Functions (3)
Updated: May 2001
#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);
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 dcgettext 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.
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.