1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
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.
8 .\" References consulted:
9 .\" GNU glibc-2 source code and manual
10 .\" GNU gettext source code and manual
11 .\" LI18NUX 2000 Globalization Specification
13 .TH BINDTEXTDOMAIN 3 "May 2001" "GNU gettext @VERSION@"
15 bindtextdomain \- set directory containing message catalogs
18 .B #include <libintl.h>
20 .BI "char * bindtextdomain (const char * " domainname ", const char * " dirname );
23 The \fBbindtextdomain\fP function sets the base directory of the hierarchy
24 containing message catalogs for a given message domain.
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.
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
36 \fIdomainname\fP must be a non-empty string.
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
45 If \fIdirname\fP is NULL, the function returns the previously set base
46 directory for domain \fIdomainname\fP.
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.
54 The following error can occur, among others:
57 Not enough memory available.
59 The return type ought to be \fBconst char *\fP, but is \fBchar *\fP to avoid
60 warnings in C code predating ANSI C.