1/* Message catalogs for internationalization.
2 Copyright (C) 1995-2022 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, see
18 <https://www.gnu.org/licenses/>. */
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/* 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)
33
34__BEGIN_DECLS
35
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). */
39extern char *gettext (const char *__msgid)
40 __THROW __attribute_format_arg__ (1);
41
42/* Look up MSGID in the DOMAINNAME message catalog for the current
43 LC_MESSAGES locale. */
44extern char *dgettext (const char *__domainname, const char *__msgid)
45 __THROW __attribute_format_arg__ (2);
46extern char *__dgettext (const char *__domainname, const char *__msgid)
47 __THROW __attribute_format_arg__ (2);
48
49/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
50 locale. */
51extern char *dcgettext (const char *__domainname,
52 const char *__msgid, int __category)
53 __THROW __attribute_format_arg__ (2);
54extern char *__dcgettext (const char *__domainname,
55 const char *__msgid, int __category)
56 __THROW __attribute_format_arg__ (2);
57
58
59/* Similar to `gettext' but select the plural form corresponding to the
60 number N. */
61extern char *ngettext (const char *__msgid1, const char *__msgid2,
62 unsigned long int __n)
63 __THROW __attribute_format_arg__ (1) __attribute_format_arg__ (2);
64
65/* Similar to `dgettext' but select the plural form corresponding to the
66 number N. */
67extern 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);
70
71/* Similar to `dcgettext' but select the plural form corresponding to the
72 number N. */
73extern 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);
77
78
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". */
82extern char *textdomain (const char *__domainname) __THROW;
83
84/* Specify that the DOMAINNAME message catalog will be found
85 in DIRNAME rather than in the system locale data base. */
86extern char *bindtextdomain (const char *__domainname,
87 const char *__dirname) __THROW;
88
89/* Specify the character encoding in which the messages from the
90 DOMAINNAME message catalog will be returned. */
91extern char *bind_textdomain_codeset (const char *__domainname,
92 const char *__codeset) __THROW;
93
94
95/* Optimized version of the function above. */
96#if defined __OPTIMIZE__ && !defined __cplusplus
97
98/* We need NULL for `gettext'. */
99# define __need_NULL
100# include <stddef.h>
101
102/* We need LC_MESSAGES for `dgettext'. */
103# include <locale.h>
104
105/* These must be macros. Inlined functions are useless because the
106 `__builtin_constant_p' predicate in dcgettext would always return
107 false. */
108
109# define gettext(msgid) dgettext (NULL, msgid)
110
111# define dgettext(domainname, msgid) \
112 dcgettext (domainname, msgid, LC_MESSAGES)
113
114# define ngettext(msgid1, msgid2, n) dngettext (NULL, msgid1, msgid2, n)
115
116# define dngettext(domainname, msgid1, msgid2, n) \
117 dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES)
118
119#endif /* Optimizing. */
120
121__END_DECLS
122
123#endif /* libintl.h */
124