| 1 |
.\" Copyright (c) Bruno Haible <[email protected]> |
| 2 |
.\" |
| 3 |
.\" This is free documentation; you can redistribute it and/or |
| 4 |
.\" modify it under the terms of the GNU General Public License as |
| 5 |
.\" published by the Free Software Foundation; either version 2 of |
| 6 |
.\" the License, or (at your option) any later version. |
| 7 |
.\" |
| 8 |
.\" References consulted: |
| 9 |
.\" GNU glibc-2 source code and manual |
| 10 |
.\" GNU gettext source code and manual |
| 11 |
.\" LI18NUX 2000 Globalization Specification |
| 12 |
.\" |
| 13 |
.TH BINDTEXTDOMAIN 3 "May 2001" "GNU gettext 0.26" |
| 14 |
.SH NAME |
| 15 |
bindtextdomain \- set directory containing message catalogs |
| 16 |
.SH SYNOPSIS |
| 17 |
.nf |
| 18 |
.B #include <libintl.h> |
| 19 |
.sp |
| 20 |
.BI "char * bindtextdomain (const char * " domainname ", const char * " dirname ); |
| 21 |
.fi |
| 22 |
.SH DESCRIPTION |
| 23 |
The \fBbindtextdomain\fP function sets the base directory of the hierarchy |
| 24 |
containing message catalogs for a given message domain. |
| 25 |
.PP |
| 26 |
A message domain is a set of translatable \fImsgid\fP messages. Usually, |
| 27 |
every software package has its own message domain. The need for calling |
| 28 |
\fBbindtextdomain\fP arises because packages are not always installed with |
| 29 |
the same prefix as the <libintl.h> header and the libc/libintl libraries. |
| 30 |
.PP |
| 31 |
Message catalogs will be expected at the pathnames |
| 32 |
\fIdirname\fP/\fIlocale\fP/\fIcategory\fP/\fIdomainname\fP.mo, |
| 33 |
where \fIlocale\fP is a locale name and \fIcategory\fP is a locale facet such |
| 34 |
as \fBLC_MESSAGES\fP. |
| 35 |
.PP |
| 36 |
\fIdomainname\fP must be a non-empty string. |
| 37 |
.PP |
| 38 |
If \fIdirname\fP is not NULL, the base directory for message catalogs belonging |
| 39 |
to domain \fIdomainname\fP is set to \fIdirname\fP. The function makes copies |
| 40 |
of the argument strings as needed. If the program wishes to call the |
| 41 |
\fBchdir\fP function, it is important that \fIdirname\fP be an absolute |
| 42 |
pathname; otherwise it cannot be guaranteed that the message catalogs will |
| 43 |
be found. |
| 44 |
.PP |
| 45 |
If \fIdirname\fP is NULL, the function returns the previously set base |
| 46 |
directory for domain \fIdomainname\fP. |
| 47 |
.SH "RETURN VALUE" |
| 48 |
If successful, the \fBbindtextdomain\fP function returns the current base |
| 49 |
directory for domain \fIdomainname\fP, after possibly changing it. The |
| 50 |
resulting string is valid until the next \fBbindtextdomain\fP call for the |
| 51 |
same \fIdomainname\fP and must not be modified or freed. If a memory allocation |
| 52 |
failure occurs, it sets \fBerrno\fP to \fBENOMEM\fP and returns NULL. |
| 53 |
.SH ERRORS |
| 54 |
The following error can occur, among others: |
| 55 |
.TP |
| 56 |
.B ENOMEM |
| 57 |
Not enough memory available. |
| 58 |
.SH BUGS |
| 59 |
The return type ought to be \fBconst char *\fP, but is \fBchar *\fP to avoid |
| 60 |
warnings in C code predating ANSI C. |
| 61 |
.SH "SEE ALSO" |
| 62 |
.BR gettext (3), |
| 63 |
.BR dgettext (3), |
| 64 |
.BR dcgettext (3), |
| 65 |
.BR ngettext (3), |
| 66 |
.BR dngettext (3), |
| 67 |
.BR dcngettext (3), |
| 68 |
.BR textdomain (3), |
| 69 |
.BR realpath (3) |