dcgettext -- perform domain and category specific lookup in message catalog


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

char * dcgettext(const char * domainname, const char * msgid, int category);


The dcgettext() function is a domain specified version of gettext().

The dcgettext() function shall lookup the translation in the current locale of the message identified by msgid 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 msgid 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().

Return Value

If a translation was found in one of the specified catalogs, it shall be converted to the current locale's codeset and returned. The resulting NULL-terminated string shall be allocated by the dcgettext function, and must not be modified or freed. If no translation was found, or category was invalid, msgid shall be returned.


dcgettext() shall not modify the errno global variable.

See Also

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