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