dcngettext -- perform domain and category specific lookup in message catalog with plural


#include <libintl.h>
#include <locale.h>

char * dcngettext(const char * domainname, const char * msgid1, const char * msgid2, unsigned long int n, int category);


The dcngettext() function is a domain specific version of gettext, capable of returning either a singular or plural form of the message. The dcngettext() function shall lookup the translation in the current locale of the message identified by msgid1 in the domain specified by domainname and in the locale category specified by category. If domainname is NULL, the current default domain shall be used. The msgid1 argument shall be a NULL-terminated string to be matched in the catalogue. category shall specify the locale category to be used for retrieving message strings. The category parameter shall be one of LC_CTYPE, LC_COLLATE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, or LC_TIME. The default domain shall not be changed by a call to dcgettext(). If n is 1 then the singular version of the message is returned, otherwise one of the plural forms is returned, depending on the value of n and the current locale settings.

Return Value

If a translation corresponding to the value of n was found in one of the specified catalogs for msgid1, it shall be converted to the current locale's codeset and returned. The resulting NULL-terminated string shall be allocated by the dcngettext() function, and must not be modified or freed. If no translation was found, or category was invalid, msgid1 shall be returned if n has the value 1, otherwise msgid2 shall be returned.


dcngettext() shall not modify the errno global variable.

See Also

gettext, dgettext, ngettext, dngettext, dcgettext, textdomain, bindtextdomain, bind_textdomain_codeset