diff options
author | Bruno Haible <bruno@clisp.org> | 2003-02-14 21:10:02 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-06-23 12:10:04 +0200 |
commit | 64fac55e0bc3fd8b5a9c3c8bd95d804a4ac27762 (patch) | |
tree | 3d05f7b49cdb514a534c184238c1a75303dd88c6 /gettext-tools | |
parent | a58486d64773a51f3f9b4527710a1af6322a2479 (diff) | |
download | external_gettext-64fac55e0bc3fd8b5a9c3c8bd95d804a4ac27762.zip external_gettext-64fac55e0bc3fd8b5a9c3c8bd95d804a4ac27762.tar.gz external_gettext-64fac55e0bc3fd8b5a9c3c8bd95d804a4ac27762.tar.bz2 |
Move man/gettext.3 to gettext-tools/man/gettext.3.
Diffstat (limited to 'gettext-tools')
-rw-r--r-- | gettext-tools/man/gettext.3 | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/gettext-tools/man/gettext.3 b/gettext-tools/man/gettext.3 new file mode 100644 index 0000000..4892c47 --- /dev/null +++ b/gettext-tools/man/gettext.3 @@ -0,0 +1,99 @@ +.\" Copyright (c) Bruno Haible <haible@clisp.cons.org> +.\" +.\" This is free documentation; you can redistribute it and/or +.\" modify it under the terms of the GNU General Public License as +.\" published by the Free Software Foundation; either version 2 of +.\" the License, or (at your option) any later version. +.\" +.\" References consulted: +.\" GNU glibc-2 source code and manual +.\" GNU gettext source code and manual +.\" LI18NUX 2000 Globalization Specification +.\" +.TH GETTEXT 3 "May 2001" "GNU gettext 0.11.6-pre2" +.SH NAME +gettext, dgettext, dcgettext \- translate message +.SH SYNOPSIS +.nf +.B #include <libintl.h> +.sp +.BI "char * gettext (const char * " msgid ); +.BI "char * dgettext (const char * " domainname ", const char * " msgid ); +.BI "char * dcgettext (const char * " domainname ", const char * " msgid , +.BI " int " category ); +.fi +.SH DESCRIPTION +The \fBgettext\fP, \fBdgettext\fP and \fBdcgettext\fP functions attempt to +translate a text string into the user's native language, by looking up the +translation in a message catalog. +.PP +The \fImsgid\fP 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 \fBmsgfmt\fP utility. +.PP +A message domain is a set of translatable \fImsgid\fP 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 \fBgettext\fP function, it is specified through +a preceding \fBtextdomain\fP call. For the \fBdgettext\fP and \fBdcgettext\fP +functions, it is passed as the \fIdomainname\fP argument; if this argument is +NULL, the domain name specified through a preceding \fBtextdomain\fP call is +used instead. +.PP +Translation lookup operates in the context of the current locale. For the +\fBgettext\fP and \fBdgettext\fP functions, the \fBLC_MESSAGES\fP locale +facet is used. It is determined by a preceding call to the \fBsetlocale\fP +function. \fBsetlocale(LC_ALL,"")\fP initializes the \fBLC_MESSAGES\fP locale +based on the first nonempty value of the three environment variables +\fBLC_ALL\fP, \fBLC_MESSAGES\fP, \fBLANG\fP; see \fBsetlocale\fP(3). For the +\fBdcgettext\fP function, the locale facet is determined by the \fIcategory\fP +argument, which should be one of the \fBLC_xxx\fP constants defined in the +<locale.h> header, excluding \fBLC_ALL\fP. In both cases, the functions also +use the \fBLC_CTYPE\fP 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 \fBbind_textdomain_codeset\fP function. +.PP +The message catalog used by the functions is at the pathname +\fIdirname\fP/\fIlocale\fP/\fIcategory\fP/\fIdomainname\fP.mo. Here +\fIdirname\fP is the directory specified through \fBbindtextdomain\fP. Its +default is system and configuration dependent; typically it is +\fIprefix\fP/share/locale, where \fIprefix\fP is the installation prefix of the +package. \fIlocale\fP is the name of the current locale facet; the GNU +implementation also tries generalizations, such as the language name without +the territory name. \fIcategory\fP is \fBLC_MESSAGES\fP for the \fBgettext\fP +and \fBdgettext\fP functions, or the argument passed to the \fBdcgettext\fP +function. +.PP +If the \fBLANGUAGE\fP environment variable is set to a nonempty value, and the +locale is not the "C" locale, the value of \fBLANGUAGE\fP is assumed to contain +a colon separated list of locale names. The functions will attempt to look up +a translation of \fImsgid\fP in each of the locales in turn. This is a GNU +extension. +.PP +In the "C" locale, or if none of the used catalogs contain a translation for +\fImsgid\fP, the \fBgettext\fP, \fBdgettext\fP and \fBdcgettext\fP functions +return \fImsgid\fP. +.SH "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 \fImsgid\fP is returned. +.SH ERRORS +\fBerrno\fP is not modified. +.SH BUGS +The return type ought to be \fBconst char *\fP, but is \fBchar *\fP to avoid +warnings in C code predating ANSI C. +.PP +When an empty string is used for \fImsgid\fP, the functions may return a +nonempty string. +.SH "SEE ALSO" +.BR ngettext (3), +.BR dngettext (3), +.BR dcngettext (3), +.BR setlocale (3), +.BR textdomain (3), +.BR bindtextdomain (3), +.BR bind_textdomain_codeset (3), +.BR msgfmt (1) |