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