The dcgettext
adds another argument to those which
dgettext
takes. This argument category specifies the last
piece of information needed to localize the message catalog. I.e., the
domain name and the locale category exactly specify which message
catalog has to be used (relative to a given directory, see below).
The dgettext
function can be expressed in terms of
dcgettext
by using
dcgettext (domain, string, LC_MESSAGES)
instead of
dgettext (domain, string)
This also shows which values are expected for the third parameter. One
has to use the available selectors for the categories available in
locale.h. Normally the available values are LC_CTYPE
,
LC_COLLATE
, LC_MESSAGES
, LC_MONETARY
,
LC_NUMERIC
, and LC_TIME
. Please note that LC_ALL
must not be used and even though the names might suggest this, there is
no relation to the environments variables of this name.
The dcgettext
function is only implemented for compatibility with
other systems which have gettext
functions. There is not really
any situation where it is necessary (or useful) to use a different value
but LC_MESSAGES
in for the category parameter. We are
dealing with messages here and any other choice can only be irritating.
As for gettext
the return value type is char *
which is an
anachronism. The returned string must never be modified.