1 /* Message catalogs for internationalization.
2 Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
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)
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.
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 Foundation,
16 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18 /* Because on some systems (e.g. Solaris) we sometimes have to include
19 the systems libintl.h as well as this file we have more complex
20 include protection above. But the systems header might perhaps also
21 define _LIBINTL_H and therefore we have to protect the definition here. */
23 #if !defined _LIBINTL_H || !defined _LIBGETTEXT_H
27 #define _LIBGETTEXT_H 1
29 /* We define an additional symbol to signal that we use the GNU
30 implementation of gettext. */
31 #define __USE_GNU_GETTEXT 1
33 #include <sys/types.h>
44 /* @@ end of prolog @@ */
47 # if __STDC__ || defined __cplusplus
48 # define PARAMS(args) args
50 # define PARAMS(args) ()
55 # if !defined __cplusplus || defined __GNUC__
56 # define NULL ((void *) 0)
63 /* This value determines the behaviour of the gettext() and dgettext()
64 function. But some system does not have this defined. Define it
65 to a default value. */
66 # define LC_MESSAGES (-1)
70 /* Declarations for gettext-using-catgets interface. Derived from
71 Jim Meyering's libintl.h. */
80 /* These two variables are defined in the automatically by po-to-tbl.sed
81 generated file `cat-id-tbl.c'. */
82 extern const struct _msg_ent _msg_tbl
[];
83 extern int _msg_tbl_length
;
87 /* For automatical extraction of messages sometimes no real
88 translation is needed. Instead the string itself is the result.
89 Do not parenthesize Str in the definiens,
90 as that breaks string literal concatenation. */
91 #define gettext_noop(Str) Str
93 /* Look up MSGID in the current default message catalog for the current
94 LC_MESSAGES locale. If not found, returns MSGID itself (the default
96 extern char *gettext
PARAMS ((const char *__msgid
));
97 extern char *gettext__
PARAMS ((const char *__msgid
));
99 /* Look up MSGID in the DOMAINNAME message catalog for the current
100 LC_MESSAGES locale. */
101 extern char *dgettext
PARAMS ((const char *__domainname
, const char *__msgid
));
102 extern char *dgettext__
PARAMS ((const char *__domainname
,
103 const char *__msgid
));
105 /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
107 extern char *dcgettext
PARAMS ((const char *__domainname
, const char *__msgid
,
109 extern char *dcgettext__
PARAMS ((const char *__domainname
,
110 const char *__msgid
, int __category
));
113 /* Set the current default message catalog to DOMAINNAME.
114 If DOMAINNAME is null, return the current default.
115 If DOMAINNAME is "", reset to the default of "messages". */
116 extern char *textdomain
PARAMS ((const char *__domainname
));
117 extern char *textdomain__
PARAMS ((const char *__domainname
));
119 /* Specify that the DOMAINNAME message catalog will be found
120 in DIRNAME rather than in the system locale data base. */
121 extern char *bindtextdomain
PARAMS ((const char *__domainname
,
122 const char *__dirname
));
123 extern char *bindtextdomain__
PARAMS ((const char *__domainname
,
124 const char *__dirname
));
128 /* Solaris 2.3 has the gettext function but dcgettext is missing.
129 So we omit this optimization for Solaris 2.3. BTW, Solaris 2.4
131 # if !HAVE_CATGETS && (!HAVE_GETTEXT || HAVE_DCGETTEXT)
133 # define gettext(Msgid) \
134 dgettext (NULL, Msgid)
136 # define dgettext(Domainname, Msgid) \
137 dcgettext (Domainname, Msgid, LC_MESSAGES)
139 # if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ >= 7
140 /* This global variable is defined in loadmsgcat.c. We need a sign,
141 whether a new catalog was loaded, which can be associated with all
143 extern int _nl_msg_cat_cntr
;
145 # define dcgettext(Domainname, Msgid, Category) \
149 if (__builtin_constant_p (Msgid)) \
151 static char *__translation__; \
152 static int __catalog_counter__; \
153 if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr) \
156 dcgettext__ (Domainname, Msgid, Category); \
157 __catalog_counter__ = _nl_msg_cat_cntr; \
159 __result = __translation__; \
162 __result = dcgettext__ (Domainname, Msgid, Category); \
170 # define gettext(Msgid) (Msgid)
171 # define dgettext(Domainname, Msgid) (Msgid)
172 # define dcgettext(Domainname, Msgid, Category) (Msgid)
173 # define textdomain(Domainname) ((char *) Domainname)
174 # define bindtextdomain(Domainname, Dirname) ((char *) Dirname)
178 /* @@ begin of epilog @@ */