alpha: Include errno.h in sysdep.h
[glibc.git] / intl / libintl.h
blobe8637e47b5c709a5cbad1e09997c2e6c62f4a8f9
1 /* Message catalogs for internationalization.
2 Copyright (C) 1995-2013 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.
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.
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.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef _LIBINTL_H
21 #define _LIBINTL_H 1
23 #include <features.h>
25 /* We define an additional symbol to signal that we use the GNU
26 implementation of gettext. */
27 #define __USE_GNU_GETTEXT 1
29 /* Provide information about the supported file formats. Returns the
30 maximum minor revision number supported for a given major revision. */
31 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) \
32 ((major) == 0 ? 1 : -1)
34 __BEGIN_DECLS
36 /* Look up MSGID in the current default message catalog for the current
37 LC_MESSAGES locale. If not found, returns MSGID itself (the default
38 text). */
39 extern char *gettext (const char *__msgid)
40 __THROW __attribute_format_arg__ (1);
42 /* Look up MSGID in the DOMAINNAME message catalog for the current
43 LC_MESSAGES locale. */
44 extern char *dgettext (const char *__domainname, const char *__msgid)
45 __THROW __attribute_format_arg__ (2);
46 extern char *__dgettext (const char *__domainname, const char *__msgid)
47 __THROW __attribute_format_arg__ (2);
49 /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
50 locale. */
51 extern char *dcgettext (const char *__domainname,
52 const char *__msgid, int __category)
53 __THROW __attribute_format_arg__ (2);
54 extern char *__dcgettext (const char *__domainname,
55 const char *__msgid, int __category)
56 __THROW __attribute_format_arg__ (2);
59 /* Similar to `gettext' but select the plural form corresponding to the
60 number N. */
61 extern char *ngettext (const char *__msgid1, const char *__msgid2,
62 unsigned long int __n)
63 __THROW __attribute_format_arg__ (1) __attribute_format_arg__ (2);
65 /* Similar to `dgettext' but select the plural form corresponding to the
66 number N. */
67 extern char *dngettext (const char *__domainname, const char *__msgid1,
68 const char *__msgid2, unsigned long int __n)
69 __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3);
71 /* Similar to `dcgettext' but select the plural form corresponding to the
72 number N. */
73 extern char *dcngettext (const char *__domainname, const char *__msgid1,
74 const char *__msgid2, unsigned long int __n,
75 int __category)
76 __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3);
79 /* Set the current default message catalog to DOMAINNAME.
80 If DOMAINNAME is null, return the current default.
81 If DOMAINNAME is "", reset to the default of "messages". */
82 extern char *textdomain (const char *__domainname) __THROW;
84 /* Specify that the DOMAINNAME message catalog will be found
85 in DIRNAME rather than in the system locale data base. */
86 extern char *bindtextdomain (const char *__domainname,
87 const char *__dirname) __THROW;
89 /* Specify the character encoding in which the messages from the
90 DOMAINNAME message catalog will be returned. */
91 extern char *bind_textdomain_codeset (const char *__domainname,
92 const char *__codeset) __THROW;
95 /* Optimized version of the function above. */
96 #if defined __OPTIMIZE__ && !defined __cplusplus
98 /* We need NULL for `gettext'. */
99 # define __need_NULL
100 # include <stddef.h>
102 /* We need LC_MESSAGES for `dgettext'. */
103 # include <locale.h>
105 /* These must be macros. Inlined functions are useless because the
106 `__builtin_constant_p' predicate in dcgettext would always return
107 false. */
109 # define gettext(msgid) dgettext (NULL, msgid)
111 # define dgettext(domainname, msgid) \
112 dcgettext (domainname, msgid, LC_MESSAGES)
114 # define ngettext(msgid1, msgid2, n) dngettext (NULL, msgid1, msgid2, n)
116 # define dngettext(domainname, msgid1, msgid2, n) \
117 dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES)
119 #endif /* Optimizing. */
121 __END_DECLS
123 #endif /* libintl.h */