1 /* libintl.h -- Message catalogs for internationalization.
2 Copyright (C) 1995 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, USA. */
25 /* We define an additional symbol to signal that we use the GNU
26 implementation of gettext. */
27 #define __USE_GNU_GETTEXT 1
31 # define __P(args) args
41 /* Look up MSGID in the current default message catalog for the current
42 LC_MESSAGES locale. If not found, returns MSGID itself (the default
44 extern char *gettext __P ((const char *__msgid));
46 /* Look up MSGID in the DOMAINNAME message catalog for the current
47 LC_MESSAGES locale. */
48 extern char *dgettext __P ((const char *__domainname, const char *__msgid));
50 /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
52 extern char *dcgettext __P ((const char *__domainname, const char *__msgid,
56 /* Set the current default message catalog to DOMAINNAME.
57 If DOMAINNAME is null, return the current default.
58 If DOMAINNAME is "", reset to the default of "messages". */
59 extern char *textdomain __P ((const char *__domainname));
61 /* Specify that the DOMAINNAME message catalog will be found
62 in DIRNAME rather than in the system locale data base. */
63 extern char *bindtextdomain __P ((const char *__domainname,
64 const char *__dirname));
67 /* Optimized version of the functions above. */
68 #if defined __OPTIMIZED
69 /* These must be a macro. Inlined functions are useless because the
70 `__builtin_constant_p' predicate in dcgettext would always return
73 # define gettext(msgid) dgettext ((char *) 0, msgid)
75 # define dgettext(domainname, msgid) \
76 dcgettext (domainname, msgid, LC_MESSAGES)
78 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
79 # define dcgettext(domainname, msgid, category) \
83 if (__builtin_constant_p (msgid)) \
85 extern int _nl_msg_cat_cntr; \
86 static char *__translation__; \
87 static int __catalog_counter__; \
88 if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr) \
91 (dcgettext) ((domainname), (msgid), (category)); \
92 __catalog_counter__ = _nl_msg_cat_cntr; \
94 result = __translation__; \
97 result = (dcgettext) ((domainname), (msgid), (category)); \
101 #endif /* Optimizing. */
108 #endif /* libintl.h */