gettext.h
author Akos Ladanyi <ladanyi@tmit.bme.hu>
Mon, 07 Jul 2008 14:54:54 +0100
changeset 2 fdb8a163000f
child 5 390d05b2d25c
permissions -rw-r--r--
Use libintl.h instead of locale.h.
hegyi@1
     1
/* Convenience header for conditional use of GNU <libintl.h>.
hegyi@1
     2
   Copyright (C) 1995-1998, 2000-2002, 2004 Free Software Foundation, Inc.
hegyi@1
     3
hegyi@1
     4
   This program is free software; you can redistribute it and/or modify it
hegyi@1
     5
   under the terms of the GNU Library General Public License as published
hegyi@1
     6
   by the Free Software Foundation; either version 2, or (at your option)
hegyi@1
     7
   any later version.
hegyi@1
     8
hegyi@1
     9
   This program is distributed in the hope that it will be useful,
hegyi@1
    10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
hegyi@1
    11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
hegyi@1
    12
   Library General Public License for more details.
hegyi@1
    13
hegyi@1
    14
   You should have received a copy of the GNU Library General Public
hegyi@1
    15
   License along with this program; if not, write to the Free Software
hegyi@1
    16
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
hegyi@1
    17
   USA.  */
hegyi@1
    18
hegyi@1
    19
#ifndef _LIBGETTEXT_H
hegyi@1
    20
#define _LIBGETTEXT_H 1
hegyi@1
    21
hegyi@1
    22
/* NLS can be disabled through the configure --disable-nls option.  */
hegyi@1
    23
#if ENABLE_NLS
hegyi@1
    24
hegyi@1
    25
/* Get declarations of GNU message catalog functions.  */
hegyi@1
    26
# include <libintl.h>
hegyi@1
    27
hegyi@1
    28
#else
hegyi@1
    29
hegyi@1
    30
/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
hegyi@1
    31
   chokes if dcgettext is defined as a macro.  So include it now, to make
hegyi@1
    32
   later inclusions of <locale.h> a NOP.  We don't include <libintl.h>
hegyi@1
    33
   as well because people using "gettext.h" will not include <libintl.h>,
hegyi@1
    34
   and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
hegyi@1
    35
   is OK.  */
hegyi@1
    36
#if defined(__sun)
hegyi@1
    37
# include <locale.h>
hegyi@1
    38
#endif
hegyi@1
    39
hegyi@1
    40
/* Many header files from the libstdc++ coming with g++ 3.3 or newer include
hegyi@1
    41
   <libintl.h>, which chokes if dcgettext is defined as a macro.  So include
hegyi@1
    42
   it now, to make later inclusions of <libintl.h> a NOP.  */
hegyi@1
    43
#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
hegyi@1
    44
# include <cstdlib>
hegyi@1
    45
# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H
hegyi@1
    46
#  include <libintl.h>
hegyi@1
    47
# endif
hegyi@1
    48
#endif
hegyi@1
    49
hegyi@1
    50
/* Disabled NLS.
hegyi@1
    51
   The casts to 'const char *' serve the purpose of producing warnings
hegyi@1
    52
   for invalid uses of the value returned from these functions.
hegyi@1
    53
   On pre-ANSI systems without 'const', the config.h file is supposed to
hegyi@1
    54
   contain "#define const".  */
hegyi@1
    55
# define gettext(Msgid) ((const char *) (Msgid))
hegyi@1
    56
# define dgettext(Domainname, Msgid) ((const char *) (Msgid))
hegyi@1
    57
# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
hegyi@1
    58
# define ngettext(Msgid1, Msgid2, N) \
hegyi@1
    59
    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
hegyi@1
    60
# define dngettext(Domainname, Msgid1, Msgid2, N) \
hegyi@1
    61
    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
hegyi@1
    62
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
hegyi@1
    63
    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
hegyi@1
    64
# define textdomain(Domainname) ((const char *) (Domainname))
hegyi@1
    65
# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
hegyi@1
    66
# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
hegyi@1
    67
hegyi@1
    68
#endif
hegyi@1
    69
hegyi@1
    70
/* A pseudo function call that serves as a marker for the automated
hegyi@1
    71
   extraction of messages, but does not call gettext().  The run-time
hegyi@1
    72
   translation is done at a different place in the code.
hegyi@1
    73
   The argument, String, should be a literal string.  Concatenated strings
hegyi@1
    74
   and other string expressions won't work.
hegyi@1
    75
   The macro's expansion is not parenthesized, so that it is suitable as
hegyi@1
    76
   initializer for static 'char[]' or 'const char[]' variables.  */
hegyi@1
    77
#define gettext_noop(String) String
hegyi@1
    78
hegyi@1
    79
#endif /* _LIBGETTEXT_H */