gettext.h
changeset 1 67188bd752db
child 5 390d05b2d25c
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gettext.h	Mon Jul 07 08:10:39 2008 -0500
     1.3 @@ -0,0 +1,79 @@
     1.4 +/* Convenience header for conditional use of GNU <libintl.h>.
     1.5 +   Copyright (C) 1995-1998, 2000-2002, 2004 Free Software Foundation, Inc.
     1.6 +
     1.7 +   This program is free software; you can redistribute it and/or modify it
     1.8 +   under the terms of the GNU Library General Public License as published
     1.9 +   by the Free Software Foundation; either version 2, or (at your option)
    1.10 +   any later version.
    1.11 +
    1.12 +   This program is distributed in the hope that it will be useful,
    1.13 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.14 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.15 +   Library General Public License for more details.
    1.16 +
    1.17 +   You should have received a copy of the GNU Library General Public
    1.18 +   License along with this program; if not, write to the Free Software
    1.19 +   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
    1.20 +   USA.  */
    1.21 +
    1.22 +#ifndef _LIBGETTEXT_H
    1.23 +#define _LIBGETTEXT_H 1
    1.24 +
    1.25 +/* NLS can be disabled through the configure --disable-nls option.  */
    1.26 +#if ENABLE_NLS
    1.27 +
    1.28 +/* Get declarations of GNU message catalog functions.  */
    1.29 +# include <libintl.h>
    1.30 +
    1.31 +#else
    1.32 +
    1.33 +/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
    1.34 +   chokes if dcgettext is defined as a macro.  So include it now, to make
    1.35 +   later inclusions of <locale.h> a NOP.  We don't include <libintl.h>
    1.36 +   as well because people using "gettext.h" will not include <libintl.h>,
    1.37 +   and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
    1.38 +   is OK.  */
    1.39 +#if defined(__sun)
    1.40 +# include <locale.h>
    1.41 +#endif
    1.42 +
    1.43 +/* Many header files from the libstdc++ coming with g++ 3.3 or newer include
    1.44 +   <libintl.h>, which chokes if dcgettext is defined as a macro.  So include
    1.45 +   it now, to make later inclusions of <libintl.h> a NOP.  */
    1.46 +#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
    1.47 +# include <cstdlib>
    1.48 +# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H
    1.49 +#  include <libintl.h>
    1.50 +# endif
    1.51 +#endif
    1.52 +
    1.53 +/* Disabled NLS.
    1.54 +   The casts to 'const char *' serve the purpose of producing warnings
    1.55 +   for invalid uses of the value returned from these functions.
    1.56 +   On pre-ANSI systems without 'const', the config.h file is supposed to
    1.57 +   contain "#define const".  */
    1.58 +# define gettext(Msgid) ((const char *) (Msgid))
    1.59 +# define dgettext(Domainname, Msgid) ((const char *) (Msgid))
    1.60 +# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
    1.61 +# define ngettext(Msgid1, Msgid2, N) \
    1.62 +    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
    1.63 +# define dngettext(Domainname, Msgid1, Msgid2, N) \
    1.64 +    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
    1.65 +# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
    1.66 +    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
    1.67 +# define textdomain(Domainname) ((const char *) (Domainname))
    1.68 +# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
    1.69 +# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
    1.70 +
    1.71 +#endif
    1.72 +
    1.73 +/* A pseudo function call that serves as a marker for the automated
    1.74 +   extraction of messages, but does not call gettext().  The run-time
    1.75 +   translation is done at a different place in the code.
    1.76 +   The argument, String, should be a literal string.  Concatenated strings
    1.77 +   and other string expressions won't work.
    1.78 +   The macro's expansion is not parenthesized, so that it is suitable as
    1.79 +   initializer for static 'char[]' or 'const char[]' variables.  */
    1.80 +#define gettext_noop(String) String
    1.81 +
    1.82 +#endif /* _LIBGETTEXT_H */