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