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


#include <libintl.h>

char * dgettext(const char * domainname, const char * msgid);


dgettext() is a domain specified version of gettext().

The dgettext() function shall search the currently selected message catalogs in the domain domainname for a string identified by the string msgid. If a string is located, that string shall be returned. The domain specified by domainname applies to the currently active LC_MESSAGE locale. The default domain shall not be changed by a call to dgettext().

Note: The usage of domainanme is equivalent in syntax and meaning to the textdomain() function's application of domainname, except that the selection of the domain in dgettext() is valid only for the duration of the call.

The dgettext() function is equivalent to dcgettext(domainname, msgid, LC_MESSAGES).

Return Value

On success of a msgid query, the translated NULL-terminated string is returned. On error, the original msgid is returned. The length of the string returned is undetermined until dgettext() is called.


dgettext() shall not modify the errno global variable.

See Also

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