1 /* Message catalogs for internationalization.
2 Copyright (C) 1995, 1996, 1997 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
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
24 /* We define an additional symbol to signal that we use the GNU
25 implementation of gettext. */
26 #define __USE_GNU_GETTEXT 1
29 # if __STDC__ || defined __cplusplus
30 # define PARAMS(args) args
32 # define PARAMS(args) ()
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
43 extern char *gettext PARAMS ((const char *__msgid));
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));
49 /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
51 extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid,
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));
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));
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
72 # define gettext(msgid) dgettext ((char *) 0, msgid)
74 # define dgettext(domainname, msgid) \
75 dcgettext (domainname, msgid, LC_MESSAGES)
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
81 extern int _nl_msg_cat_cntr;
83 # define dcgettext(domainname, msgid, category) \
87 if (__builtin_constant_p (msgid)) \
89 static char *__translation__; \
90 static int __catalog_counter__; \
91 if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr) \
94 (dcgettext) ((domainname), (msgid), (category)); \
95 __catalog_counter__ = _nl_msg_cat_cntr; \
97 __result = __translation__; \
100 __result = (dcgettext) ((domainname), (msgid), (category)); \
104 #endif /* Optimizing. */
111 #endif /* libintl.h */