Node:Charset conversion in gettext, Next:GUI program problems, Previous:Advanced gettext functions, Up:Message catalogs with gettext
gettext usesgettext not only looks up a translation in a message catalog. It
also converts the translation on the fly to the desired output character
set. This is useful if the user is working in a different character set
than the translator who created the message catalog, because it avoids
distributing variants of message catalogs which differ only in the
character set.
The output character set is, by default, the value of nl_langinfo
(CODESET), which depends on the LC_CTYPE part of the current
locale. But programs which store strings in a locale independent way
(e.g. UTF-8) can request that gettext and related functions
return the translations in that encoding, by use of the
bind_textdomain_codeset function.
Note that the msgid argument to gettext is not subject to
character set conversion. Also, when gettext does not find a
translation for msgid, it returns msgid unchanged -
independently of the current output character set. It is therefore
recommended that all msgids be US-ASCII strings.
| char * bind_textdomain_codeset (const char *domainname, const char *codeset) | Function |
The bind_textdomain_codeset function can be used to specify the
output character set for message catalogs for domain domainname.
The codeset argument must be a valid codeset name which can be used
for the iconv_open function, or a null pointer.
If the codeset parameter is the null pointer,
The The |