1*3d8817e4Smiod /* Message catalogs for internationalization. 2*3d8817e4Smiod Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. 3*3d8817e4Smiod 4*3d8817e4Smiod This program is free software; you can redistribute it and/or modify 5*3d8817e4Smiod it under the terms of the GNU General Public License as published by 6*3d8817e4Smiod the Free Software Foundation; either version 2, or (at your option) 7*3d8817e4Smiod any later version. 8*3d8817e4Smiod 9*3d8817e4Smiod This program is distributed in the hope that it will be useful, 10*3d8817e4Smiod but WITHOUT ANY WARRANTY; without even the implied warranty of 11*3d8817e4Smiod MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12*3d8817e4Smiod GNU General Public License for more details. 13*3d8817e4Smiod 14*3d8817e4Smiod You should have received a copy of the GNU General Public License 15*3d8817e4Smiod along with this program; if not, write to the Free Software Foundation, 16*3d8817e4Smiod Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 17*3d8817e4Smiod 18*3d8817e4Smiod /* Because on some systems (e.g. Solaris) we sometimes have to include 19*3d8817e4Smiod the systems libintl.h as well as this file we have more complex 20*3d8817e4Smiod include protection above. But the systems header might perhaps also 21*3d8817e4Smiod define _LIBINTL_H and therefore we have to protect the definition here. */ 22*3d8817e4Smiod 23*3d8817e4Smiod #if !defined _LIBINTL_H || !defined _LIBGETTEXT_H 24*3d8817e4Smiod #ifndef _LIBINTL_H 25*3d8817e4Smiod # define _LIBINTL_H 1 26*3d8817e4Smiod #endif 27*3d8817e4Smiod #define _LIBGETTEXT_H 1 28*3d8817e4Smiod 29*3d8817e4Smiod /* We define an additional symbol to signal that we use the GNU 30*3d8817e4Smiod implementation of gettext. */ 31*3d8817e4Smiod #define __USE_GNU_GETTEXT 1 32*3d8817e4Smiod 33*3d8817e4Smiod #include <sys/types.h> 34*3d8817e4Smiod 35*3d8817e4Smiod #if HAVE_LOCALE_H 36*3d8817e4Smiod # include <locale.h> 37*3d8817e4Smiod #endif 38*3d8817e4Smiod 39*3d8817e4Smiod 40*3d8817e4Smiod #ifdef __cplusplus 41*3d8817e4Smiod extern "C" { 42*3d8817e4Smiod #endif 43*3d8817e4Smiod 44*3d8817e4Smiod /* @@ end of prolog @@ */ 45*3d8817e4Smiod 46*3d8817e4Smiod #ifndef PARAMS 47*3d8817e4Smiod # if __STDC__ || defined __cplusplus 48*3d8817e4Smiod # define PARAMS(args) args 49*3d8817e4Smiod # else 50*3d8817e4Smiod # define PARAMS(args) () 51*3d8817e4Smiod # endif 52*3d8817e4Smiod #endif 53*3d8817e4Smiod 54*3d8817e4Smiod #ifndef NULL 55*3d8817e4Smiod # if !defined __cplusplus || defined __GNUC__ 56*3d8817e4Smiod # define NULL ((void *) 0) 57*3d8817e4Smiod # else 58*3d8817e4Smiod # define NULL (0) 59*3d8817e4Smiod # endif 60*3d8817e4Smiod #endif 61*3d8817e4Smiod 62*3d8817e4Smiod #if !HAVE_LC_MESSAGES 63*3d8817e4Smiod /* This value determines the behaviour of the gettext() and dgettext() 64*3d8817e4Smiod function. But some system does not have this defined. Define it 65*3d8817e4Smiod to a default value. */ 66*3d8817e4Smiod # define LC_MESSAGES (-1) 67*3d8817e4Smiod #endif 68*3d8817e4Smiod 69*3d8817e4Smiod 70*3d8817e4Smiod /* Declarations for gettext-using-catgets interface. Derived from 71*3d8817e4Smiod Jim Meyering's libintl.h. */ 72*3d8817e4Smiod struct _msg_ent 73*3d8817e4Smiod { 74*3d8817e4Smiod const char *_msg; 75*3d8817e4Smiod int _msg_number; 76*3d8817e4Smiod }; 77*3d8817e4Smiod 78*3d8817e4Smiod 79*3d8817e4Smiod #if HAVE_CATGETS 80*3d8817e4Smiod /* These two variables are defined in the automatically by po-to-tbl.sed 81*3d8817e4Smiod generated file `cat-id-tbl.c'. */ 82*3d8817e4Smiod extern const struct _msg_ent _msg_tbl[]; 83*3d8817e4Smiod extern int _msg_tbl_length; 84*3d8817e4Smiod #endif 85*3d8817e4Smiod 86*3d8817e4Smiod 87*3d8817e4Smiod /* For automatical extraction of messages sometimes no real 88*3d8817e4Smiod translation is needed. Instead the string itself is the result. */ 89*3d8817e4Smiod #define gettext_noop(Str) (Str) 90*3d8817e4Smiod 91*3d8817e4Smiod /* Look up MSGID in the current default message catalog for the current 92*3d8817e4Smiod LC_MESSAGES locale. If not found, returns MSGID itself (the default 93*3d8817e4Smiod text). */ 94*3d8817e4Smiod extern char *gettext PARAMS ((const char *__msgid)); 95*3d8817e4Smiod extern char *gettext__ PARAMS ((const char *__msgid)); 96*3d8817e4Smiod 97*3d8817e4Smiod /* Look up MSGID in the DOMAINNAME message catalog for the current 98*3d8817e4Smiod LC_MESSAGES locale. */ 99*3d8817e4Smiod extern char *dgettext PARAMS ((const char *__domainname, const char *__msgid)); 100*3d8817e4Smiod extern char *dgettext__ PARAMS ((const char *__domainname, 101*3d8817e4Smiod const char *__msgid)); 102*3d8817e4Smiod 103*3d8817e4Smiod /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY 104*3d8817e4Smiod locale. */ 105*3d8817e4Smiod extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid, 106*3d8817e4Smiod int __category)); 107*3d8817e4Smiod extern char *dcgettext__ PARAMS ((const char *__domainname, 108*3d8817e4Smiod const char *__msgid, int __category)); 109*3d8817e4Smiod 110*3d8817e4Smiod 111*3d8817e4Smiod /* Set the current default message catalog to DOMAINNAME. 112*3d8817e4Smiod If DOMAINNAME is null, return the current default. 113*3d8817e4Smiod If DOMAINNAME is "", reset to the default of "messages". */ 114*3d8817e4Smiod extern char *textdomain PARAMS ((const char *__domainname)); 115*3d8817e4Smiod extern char *textdomain__ PARAMS ((const char *__domainname)); 116*3d8817e4Smiod 117*3d8817e4Smiod /* Specify that the DOMAINNAME message catalog will be found 118*3d8817e4Smiod in DIRNAME rather than in the system locale data base. */ 119*3d8817e4Smiod extern char *bindtextdomain PARAMS ((const char *__domainname, 120*3d8817e4Smiod const char *__dirname)); 121*3d8817e4Smiod extern char *bindtextdomain__ PARAMS ((const char *__domainname, 122*3d8817e4Smiod const char *__dirname)); 123*3d8817e4Smiod 124*3d8817e4Smiod #if ENABLE_NLS 125*3d8817e4Smiod 126*3d8817e4Smiod /* Solaris 2.3 has the gettext function but dcgettext is missing. 127*3d8817e4Smiod So we omit this optimization for Solaris 2.3. BTW, Solaris 2.4 128*3d8817e4Smiod has dcgettext. */ 129*3d8817e4Smiod # if !HAVE_CATGETS && (!HAVE_GETTEXT || HAVE_DCGETTEXT) 130*3d8817e4Smiod 131*3d8817e4Smiod # define gettext(Msgid) \ 132*3d8817e4Smiod dgettext (NULL, Msgid) 133*3d8817e4Smiod 134*3d8817e4Smiod # define dgettext(Domainname, Msgid) \ 135*3d8817e4Smiod dcgettext (Domainname, Msgid, LC_MESSAGES) 136*3d8817e4Smiod 137*3d8817e4Smiod # if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ >= 7 138*3d8817e4Smiod /* This global variable is defined in loadmsgcat.c. We need a sign, 139*3d8817e4Smiod whether a new catalog was loaded, which can be associated with all 140*3d8817e4Smiod translations. */ 141*3d8817e4Smiod extern int _nl_msg_cat_cntr; 142*3d8817e4Smiod 143*3d8817e4Smiod # define dcgettext(Domainname, Msgid, Category) \ 144*3d8817e4Smiod (__extension__ \ 145*3d8817e4Smiod ({ \ 146*3d8817e4Smiod char *__result; \ 147*3d8817e4Smiod if (__builtin_constant_p (Msgid)) \ 148*3d8817e4Smiod { \ 149*3d8817e4Smiod static char *__translation__; \ 150*3d8817e4Smiod static int __catalog_counter__; \ 151*3d8817e4Smiod if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr) \ 152*3d8817e4Smiod { \ 153*3d8817e4Smiod __translation__ = \ 154*3d8817e4Smiod dcgettext__ (Domainname, Msgid, Category); \ 155*3d8817e4Smiod __catalog_counter__ = _nl_msg_cat_cntr; \ 156*3d8817e4Smiod } \ 157*3d8817e4Smiod __result = __translation__; \ 158*3d8817e4Smiod } \ 159*3d8817e4Smiod else \ 160*3d8817e4Smiod __result = dcgettext__ (Domainname, Msgid, Category); \ 161*3d8817e4Smiod __result; \ 162*3d8817e4Smiod })) 163*3d8817e4Smiod # endif 164*3d8817e4Smiod # endif 165*3d8817e4Smiod 166*3d8817e4Smiod #else 167*3d8817e4Smiod 168*3d8817e4Smiod # define gettext(Msgid) (Msgid) 169*3d8817e4Smiod # define dgettext(Domainname, Msgid) (Msgid) 170*3d8817e4Smiod # define dcgettext(Domainname, Msgid, Category) (Msgid) 171*3d8817e4Smiod # define textdomain(Domainname) ((char *) Domainname) 172*3d8817e4Smiod # define bindtextdomain(Domainname, Dirname) ((char *) Dirname) 173*3d8817e4Smiod 174*3d8817e4Smiod #endif 175*3d8817e4Smiod 176*3d8817e4Smiod /* @@ begin of epilog @@ */ 177*3d8817e4Smiod 178*3d8817e4Smiod #ifdef __cplusplus 179*3d8817e4Smiod } 180*3d8817e4Smiod #endif 181*3d8817e4Smiod 182*3d8817e4Smiod #endif 183