dcngettext -- perform lookup in message catalog for the current LC_MESSAGES locale


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

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


dcngettext is a plural version of dcgettext. (See dcgettext for more information.)



dcngettext applies domainname to the currently active LC_MESSAGE locale. This usage is equivalent in syntax and meaning to the textdomain function's application of domainname, except that the selection of the domain in dcngettext is valid only for the duration of the call.


a NULL-terminated string to be matched in the catalogue with respect to a specific domain and the current locale. If the value of n is 1 and no message catalogs containing a translation for msgid1 are found, msgid1 is returned.


a NULL-terminated string to be returned if the value of n is not 1 and no message catalogs are found.


determines which plural form is returned, in a language and message catalog dependent way.


category is used for retrieving messages string for other than LC_MESSAGES category. Available value for category are LC_CTYPE, LC_COLLATE, LC_MESSAGES, LC_MONETARY,LC_NUMERIC, and LC_TIME.

dcngettext(domainname, msgid1, msgid2, n, LC_MESSAGES) has the same specification as dngettext(domainname, msgid1, msgid2, n). Note that LC_ALL must not be used.

Return Value

On success of a msgid1 query, the translated NULL-terminated string is returned. On error, the original msgid1 or msgid2 is returned, according to n.


dcngettext will not modify the errno global variable.

See Also

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