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