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