]> git.ipfire.org Git - thirdparty/glibc.git/blame - intl/libintl.h
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / intl / libintl.h
CommitLineData
40a55d20 1/* Message catalogs for internationalization.
04277e02 2 Copyright (C) 1995-2019 Free Software Foundation, Inc.
41bdb6e2 3 This file is part of the GNU C Library.
54d79e99 4 This file is derived from the file libgettext.h in the GNU gettext package.
2b83a2a4 5
54d79e99 6 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
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.
2b83a2a4 10
54d79e99
UD
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
41bdb6e2 14 Lesser General Public License for more details.
2b83a2a4 15
41bdb6e2 16 You should have received a copy of the GNU Lesser General Public
59ba27a6 17 License along with the GNU C Library; if not, see
5a82c748 18 <https://www.gnu.org/licenses/>. */
2b83a2a4
RM
19
20#ifndef _LIBINTL_H
c709e372 21#define _LIBINTL_H 1
5107cf1d 22
c709e372 23#include <features.h>
2b83a2a4 24
c709e372
RM
25/* We define an additional symbol to signal that we use the GNU
26 implementation of gettext. */
27#define __USE_GNU_GETTEXT 1
28
3172f58f
UD
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
c709e372 34__BEGIN_DECLS
2b83a2a4
RM
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). */
a784e502 39extern char *gettext (const char *__msgid)
83c0f41f 40 __THROW __attribute_format_arg__ (1);
2b83a2a4
RM
41
42/* Look up MSGID in the DOMAINNAME message catalog for the current
43 LC_MESSAGES locale. */
a784e502 44extern char *dgettext (const char *__domainname, const char *__msgid)
83c0f41f 45 __THROW __attribute_format_arg__ (2);
a784e502 46extern char *__dgettext (const char *__domainname, const char *__msgid)
ca8d5a5f 47 __THROW __attribute_format_arg__ (2);
2b83a2a4
RM
48
49/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
50 locale. */
a784e502
UD
51extern char *dcgettext (const char *__domainname,
52 const char *__msgid, int __category)
83c0f41f 53 __THROW __attribute_format_arg__ (2);
a784e502
UD
54extern char *__dcgettext (const char *__domainname,
55 const char *__msgid, int __category)
ca8d5a5f 56 __THROW __attribute_format_arg__ (2);
2b83a2a4
RM
57
58
abbffdf9
UD
59/* Similar to `gettext' but select the plural form corresponding to the
60 number N. */
a784e502 61extern char *ngettext (const char *__msgid1, const char *__msgid2,
964328be 62 unsigned long int __n)
f369623d 63 __THROW __attribute_format_arg__ (1) __attribute_format_arg__ (2);
abbffdf9
UD
64
65/* Similar to `dgettext' but select the plural form corresponding to the
66 number N. */
a784e502
UD
67extern char *dngettext (const char *__domainname, const char *__msgid1,
68 const char *__msgid2, unsigned long int __n)
f369623d 69 __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3);
abbffdf9 70
9d9160ee 71/* Similar to `dcgettext' but select the plural form corresponding to the
abbffdf9 72 number N. */
a784e502
UD
73extern char *dcngettext (const char *__domainname, const char *__msgid1,
74 const char *__msgid2, unsigned long int __n,
964328be 75 int __category)
f369623d 76 __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3);
abbffdf9
UD
77
78
2b83a2a4
RM
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". */
a784e502 82extern char *textdomain (const char *__domainname) __THROW;
2b83a2a4
RM
83
84/* Specify that the DOMAINNAME message catalog will be found
85 in DIRNAME rather than in the system locale data base. */
a784e502
UD
86extern char *bindtextdomain (const char *__domainname,
87 const char *__dirname) __THROW;
c709e372 88
17c389fc
UD
89/* Specify the character encoding in which the messages from the
90 DOMAINNAME message catalog will be returned. */
a784e502
UD
91extern char *bind_textdomain_codeset (const char *__domainname,
92 const char *__codeset) __THROW;
17c389fc 93
2b83a2a4 94
c709e372 95/* Optimized version of the function above. */
84b5ba7e 96#if defined __OPTIMIZE__ && !defined __cplusplus
036cc82f
RM
97
98/* We need NULL for `gettext'. */
40a55d20
UD
99# define __need_NULL
100# include <stddef.h>
036cc82f
RM
101
102/* We need LC_MESSAGES for `dgettext'. */
103# include <locale.h>
104
105/* These must be macros. Inlined functions are useless because the
c709e372
RM
106 `__builtin_constant_p' predicate in dcgettext would always return
107 false. */
2b83a2a4 108
be10a868 109# define gettext(msgid) dgettext (NULL, msgid)
2b83a2a4 110
e6d18111 111# define dgettext(domainname, msgid) \
c709e372 112 dcgettext (domainname, msgid, LC_MESSAGES)
2b83a2a4 113
e6d18111 114# define ngettext(msgid1, msgid2, n) dngettext (NULL, msgid1, msgid2, n)
abbffdf9 115
e6d18111
UD
116# define dngettext(domainname, msgid1, msgid2, n) \
117 dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES)
abbffdf9 118
575b273b 119#endif /* Optimizing. */
c709e372
RM
120
121__END_DECLS
2b83a2a4 122
c709e372 123#endif /* libintl.h */