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