Home
Main website
Loading Sidebar...
Hide Ads
Recent Changes
View Source:
gettext(3)
Edit
PageHistory
Diff
Info
LikePages
GETTEXT !!!GETTEXT NAME SYNOPSIS DESCRIPTION RETURN VALUE ERRORS BUGS SEE ALSO ---- !!NAME gettext, dgettext, dcgettext - translate message !!SYNOPSIS __#include __ ''msgid''__); char * dgettext (const char *__ ''domainname''__, const char *__ ''msgid''__); char * dcgettext (const char *__ ''domainname''__, const char *__ ''msgid''__, int__ ''category''__); __ !!DESCRIPTION The __gettext__, __dgettext__ and __dcgettext__ functions attempt to translate a text string into the user's native language, by looking up the translation in a message catalog. The ''msgid'' argument identifies the message to be translated. By convention, it is the English version of the message, with non-ASCII characters replaced by ASCII approximations. This choice allows the translators to work with message catalogs, called PO files, that contain both the English and the translated versions of each message, and can be installed using the __msgfmt__ utility. A message domain is a set of translatable ''msgid'' messages. Usually, every software package has its own message domain. The domain name is used to determine the message catalog where the translation is looked up; it must be a non-empty string. For the __gettext__ function, it is specified through a preceding __textdomain__ call. For the __dgettext__ and __dcgettext__ functions, it is passed as the ''domainname'' argument; if this argument is NULL, the domain name specified through a preceding __textdomain__ call is used instead. Translation lookup operates in the context of the current locale. For the __gettext__ and __dgettext__ functions, the __LC_MESSAGES__ locale facet is used. It is determined by a preceding call to the __setlocale__ function. __setlocale(LC_ALL,__ initializes the __LC_MESSAGES__ locale based on the first nonempty value of the three environment variables __LC_ALL__, __LC_MESSAGES__, __LANG__; see setlocale(3). For the __dcgettext__ function, the locale facet is determined by the ''category'' argument, which should be one of the __LC_xxx__ constants defined in the __LC_ALL__. In both cases, the functions also use the __LC_CTYPE__ locale facet in order to convert the translated message from the translator's codeset to the current locale's codeset, unless overridden by a prior call to the __bind_textdomain_codeset__ function. The message catalog used by the functions is at the pathname ''dirname''/''locale''/''category''/''domainname''.mo. Here ''dirname'' is the directory specified through __bindtextdomain__. Its default is system and configuration dependent; typically it is ''prefix''/share/locale, where ''prefix'' is the installation prefix of the package. ''locale'' is the name of the current locale facet; the GNU implementation also tries generalizations, such as the language name without the territory name. ''category'' is __LC_MESSAGES__ for the __gettext__ and __dgettext__ functions, or the argument passed to the __dcgettext__ function. If the __LANGUAGE__ environment variable is set to a nonempty value, and the locale is not the __LANGUAGE__ is assumed to contain a colon separated list of locale names. The functions will attempt to look up a translation of ''msgid'' in each of the locales in turn. This is a GNU extension. In the msgid'', the __gettext__, __dgettext__ and __dcgettext__ functions return ''msgid''. !!RETURN VALUE If a translation was found in one of the specified catalogs, it is converted to the locale's codeset and returned. The resulting string is statically allocated and must not be modified or freed. Otherwise ''msgid'' is returned. !!ERRORS __errno__ is not modified. !!BUGS The return type ought to be __const char *__, but is __char *__ to avoid warnings in C code predating ANSI C. When an empty string is used for ''msgid'', the functions may return a nonempty string. !!SEE ALSO ngettext(3), dngettext(3), dcngettext(3), setlocale(3), textdomain(3), bindtextdomain(3), bind_textdomain_codeset(3), msgfmt(1) ----
5 pages link to
gettext(3)
:
Man3g
textdomain(3)
bind_textdomain_codeset(3)
bindtextdomain(3)
ngettext(3)
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.