Update to LGPL v2.1.
[platform/upstream/glibc.git] / intl / libintl.h
1 /* Message catalogs for internationalization.
2    Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4    This file is derived from the file libgettext.h in the GNU gettext package.
5
6    The GNU C Library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
10
11    The GNU C Library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15
16    You should have received a copy of the GNU Lesser General Public
17    License along with the GNU C Library; if not, write to the Free
18    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19    02111-1307 USA.  */
20
21 #ifndef _LIBINTL_H
22 #define _LIBINTL_H      1
23
24 #include <features.h>
25
26 /* We define an additional symbol to signal that we use the GNU
27    implementation of gettext.  */
28 #define __USE_GNU_GETTEXT 1
29
30 __BEGIN_DECLS
31
32 /* Look up MSGID in the current default message catalog for the current
33    LC_MESSAGES locale.  If not found, returns MSGID itself (the default
34    text).  */
35 extern char *gettext (__const char *__msgid) __THROW;
36
37 /* Look up MSGID in the DOMAINNAME message catalog for the current
38    LC_MESSAGES locale.  */
39 extern char *dgettext (__const char *__domainname, __const char *__msgid)
40      __THROW;
41 extern char *__dgettext (__const char *__domainname, __const char *__msgid)
42      __THROW __attribute_format_arg__ (2);
43
44 /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
45    locale.  */
46 extern char *dcgettext (__const char *__domainname,
47                         __const char *__msgid, int __category) __THROW;
48 extern char *__dcgettext (__const char *__domainname,
49                           __const char *__msgid, int __category)
50      __THROW __attribute_format_arg__ (2);
51
52
53 /* Similar to `gettext' but select the plural form corresponding to the
54    number N.  */
55 extern char *ngettext (__const char *__msgid1, __const char *__msgid2,
56                        unsigned long int __n)
57      __THROW __attribute_format_arg__ (1);
58
59 /* Similar to `dgettext' but select the plural form corresponding to the
60    number N.  */
61 extern char *dngettext (__const char *__domainname, __const char *__msgid1,
62                         __const char *__msgid2, unsigned long int __n)
63      __THROW __attribute_format_arg__ (2);
64
65 /* Similar to `dcgettext' but select the plural form corresponding to the
66    number N.  */
67 extern char *dcngettext (__const char *__domainname, __const char *__msgid1,
68                          __const char *__msgid2, unsigned long int __n,
69                          int __category)
70      __THROW __attribute_format_arg__ (2);
71
72
73 /* Set the current default message catalog to DOMAINNAME.
74    If DOMAINNAME is null, return the current default.
75    If DOMAINNAME is "", reset to the default of "messages".  */
76 extern char *textdomain (__const char *__domainname) __THROW;
77
78 /* Specify that the DOMAINNAME message catalog will be found
79    in DIRNAME rather than in the system locale data base.  */
80 extern char *bindtextdomain (__const char *__domainname,
81                              __const char *__dirname) __THROW;
82
83 /* Specify the character encoding in which the messages from the
84    DOMAINNAME message catalog will be returned.  */
85 extern char *bind_textdomain_codeset (__const char *__domainname,
86                                       __const char *__codeset) __THROW;
87
88
89 /* Optimized version of the function above.  */
90 #if defined __OPTIMIZE__
91
92 /* We need NULL for `gettext'.  */
93 # define __need_NULL
94 # include <stddef.h>
95
96 /* We need LC_MESSAGES for `dgettext'.  */
97 # include <locale.h>
98
99 /* These must be macros.  Inlined functions are useless because the
100    `__builtin_constant_p' predicate in dcgettext would always return
101    false.  */
102
103 # define gettext(msgid) dgettext (NULL, msgid)
104
105 # define dgettext(domainname, msgid) \
106   dcgettext (domainname, msgid, LC_MESSAGES)
107
108 # define ngettext(msgid1, msgid2, n) dngettext (NULL, msgid1, msgid2, n)
109
110 # define dngettext(domainname, msgid1, msgid2, n) \
111   dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES)
112
113 #endif  /* Optimizing.  */
114
115 __END_DECLS
116
117 #endif /* libintl.h */