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