1 |
106 |
markom |
/* Message catalogs for internationalization.
|
2 |
|
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
3 |
|
|
|
4 |
|
|
This program is free software; you can redistribute it and/or modify
|
5 |
|
|
it under the terms of the GNU General Public License as published by
|
6 |
|
|
the Free Software Foundation; either version 2, or (at your option)
|
7 |
|
|
any later version.
|
8 |
|
|
|
9 |
|
|
This program is distributed in the hope that it will be useful,
|
10 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
|
|
GNU General Public License for more details.
|
13 |
|
|
|
14 |
|
|
You should have received a copy of the GNU General Public License
|
15 |
|
|
along with this program; if not, write to the Free Software
|
16 |
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
17 |
|
|
USA. */
|
18 |
|
|
|
19 |
|
|
#ifndef _LIBINTL_H
|
20 |
|
|
#define _LIBINTL_H 1
|
21 |
|
|
|
22 |
|
|
@INCLUDE_LOCALE_H@
|
23 |
|
|
|
24 |
|
|
/* We define an additional symbol to signal that we use the GNU
|
25 |
|
|
implementation of gettext. */
|
26 |
|
|
#define __USE_GNU_GETTEXT 1
|
27 |
|
|
|
28 |
|
|
#ifndef PARAMS
|
29 |
|
|
# if __STDC__
|
30 |
|
|
# define PARAMS(args) args
|
31 |
|
|
# else
|
32 |
|
|
# define PARAMS(args) ()
|
33 |
|
|
# endif
|
34 |
|
|
#endif
|
35 |
|
|
|
36 |
|
|
#ifdef __cplusplus
|
37 |
|
|
extern "C" {
|
38 |
|
|
#endif
|
39 |
|
|
|
40 |
|
|
/* Look up MSGID in the current default message catalog for the current
|
41 |
|
|
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
42 |
|
|
text). */
|
43 |
|
|
extern char *gettext PARAMS ((const char *__msgid));
|
44 |
|
|
|
45 |
|
|
/* Look up MSGID in the DOMAINNAME message catalog for the current
|
46 |
|
|
LC_MESSAGES locale. */
|
47 |
|
|
extern char *dgettext PARAMS ((const char *__domainname, const char *__msgid));
|
48 |
|
|
|
49 |
|
|
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
50 |
|
|
locale. */
|
51 |
|
|
extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid,
|
52 |
|
|
int __category));
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
/* Set the current default message catalog to DOMAINNAME.
|
56 |
|
|
If DOMAINNAME is null, return the current default.
|
57 |
|
|
If DOMAINNAME is "", reset to the default of "messages". */
|
58 |
|
|
extern char *textdomain PARAMS ((const char *__domainname));
|
59 |
|
|
|
60 |
|
|
/* Specify that the DOMAINNAME message catalog will be found
|
61 |
|
|
in DIRNAME rather than in the system locale data base. */
|
62 |
|
|
extern char *bindtextdomain PARAMS ((const char *__domainname,
|
63 |
|
|
const char *__dirname));
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
/* Optimized version of the functions above. */
|
67 |
|
|
#if defined __OPTIMIZED
|
68 |
|
|
/* These must be a macro. Inlined functions are useless because the
|
69 |
|
|
`__builtin_constant_p' predicate in dcgettext would always return
|
70 |
|
|
false. */
|
71 |
|
|
|
72 |
|
|
# define gettext(msgid) dgettext ((char *) 0, msgid)
|
73 |
|
|
|
74 |
|
|
# define dgettext(domainname, msgid) \
|
75 |
|
|
dcgettext (domainname, msgid, LC_MESSAGES)
|
76 |
|
|
|
77 |
|
|
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
|
78 |
|
|
/* This global variable is defined in loadmsgcat.c. We need a sign,
|
79 |
|
|
whether a new catalog was loaded, which can be associated with all
|
80 |
|
|
translations. */
|
81 |
|
|
extern int _nl_msg_cat_cntr;
|
82 |
|
|
|
83 |
|
|
# define dcgettext(domainname, msgid, category) \
|
84 |
|
|
(__extension__ \
|
85 |
|
|
({ \
|
86 |
|
|
char *__result; \
|
87 |
|
|
if (__builtin_constant_p (msgid)) \
|
88 |
|
|
{ \
|
89 |
|
|
static char *__translation__; \
|
90 |
|
|
static int __catalog_counter__; \
|
91 |
|
|
if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr) \
|
92 |
|
|
{ \
|
93 |
|
|
__translation__ = \
|
94 |
|
|
(dcgettext) ((domainname), (msgid), (category)); \
|
95 |
|
|
__catalog_counter__ = _nl_msg_cat_cntr; \
|
96 |
|
|
} \
|
97 |
|
|
__result = __translation__; \
|
98 |
|
|
} \
|
99 |
|
|
else \
|
100 |
|
|
__result = (dcgettext) ((domainname), (msgid), (category)); \
|
101 |
|
|
__result; \
|
102 |
|
|
}))
|
103 |
|
|
# endif
|
104 |
|
|
#endif /* Optimizing. */
|
105 |
|
|
|
106 |
|
|
|
107 |
|
|
#ifdef __cplusplus
|
108 |
|
|
}
|
109 |
|
|
#endif
|
110 |
|
|
|
111 |
|
|
#endif /* libintl.h */
|