1BINDTEXTDOMAIN(3) Library Functions Manual BINDTEXTDOMAIN(3)
2
3
4
6 bindtextdomain - set directory containing message catalogs
7
9 #include <libintl.h>
10
11 char * bindtextdomain (const char * domainname, const char * dirname);
12
14 The bindtextdomain function sets the base directory of the hierarchy
15 containing message catalogs for a given message domain.
16
17 A message domain is a set of translatable msgid messages. Usually,
18 every software package has its own message domain. The need for calling
19 bindtextdomain arises because packages are not always installed with
20 the same prefix as the <libintl.h> header and the libc/libintl
21 libraries.
22
23 Message catalogs will be expected at the pathnames dirname/locale/cate‐
24 gory/domainname.mo, where locale is a locale name and category is a
25 locale facet such as LC_MESSAGES.
26
27 domainname must be a non-empty string.
28
29 If dirname is not NULL, the base directory for message catalogs belong‐
30 ing to domain domainname is set to dirname. The function makes copies
31 of the argument strings as needed. If the program wishes to call the
32 chdir function, it is important that dirname be an absolute pathname;
33 otherwise it cannot be guaranteed that the message catalogs will be
34 found.
35
36 If dirname is NULL, the function returns the previously set base direc‐
37 tory for domain domainname.
38
40 If successful, the bindtextdomain function returns the current base
41 directory for domain domainname, after possibly changing it. The
42 resulting string is valid until the next bindtextdomain call for the
43 same domainname and must not be modified or freed. If a memory alloca‐
44 tion failure occurs, it sets errno to ENOMEM and returns NULL.
45
47 The following error can occur, among others:
48
49 ENOMEM Not enough memory available.
50
52 The return type ought to be const char *, but is char * to avoid warn‐
53 ings in C code predating ANSI C.
54
56 gettext(3), dgettext(3), dcgettext(3), ngettext(3), dngettext(3),
57 dcngettext(3), textdomain(3), realpath(3)
58
59
60
61GNU gettext 0.19.8.1 May 2001 BINDTEXTDOMAIN(3)