xref: /freebsd/contrib/diff/lib/gettext.h (revision 18fd37a72c3a7549d2d4f6c6ea00bdcd2bdaca01)
118fd37a7SXin LI /* Convenience header for conditional use of GNU <libintl.h>.
218fd37a7SXin LI    Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc.
318fd37a7SXin LI 
418fd37a7SXin LI    This program is free software; you can redistribute it and/or modify
518fd37a7SXin LI    it under the terms of the GNU General Public License as published by
618fd37a7SXin LI    the Free Software Foundation; either version 2, or (at your option)
718fd37a7SXin LI    any later version.
818fd37a7SXin LI 
918fd37a7SXin LI    This program is distributed in the hope that it will be useful,
1018fd37a7SXin LI    but WITHOUT ANY WARRANTY; without even the implied warranty of
1118fd37a7SXin LI    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1218fd37a7SXin LI    GNU General Public License for more details.
1318fd37a7SXin LI 
1418fd37a7SXin LI    You should have received a copy of the GNU General Public License along
1518fd37a7SXin LI    with this program; if not, write to the Free Software Foundation,
1618fd37a7SXin LI    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
1718fd37a7SXin LI 
1818fd37a7SXin LI #ifndef _LIBGETTEXT_H
1918fd37a7SXin LI #define _LIBGETTEXT_H 1
2018fd37a7SXin LI 
2118fd37a7SXin LI /* NLS can be disabled through the configure --disable-nls option.  */
2218fd37a7SXin LI #if ENABLE_NLS
2318fd37a7SXin LI 
2418fd37a7SXin LI /* Get declarations of GNU message catalog functions.  */
2518fd37a7SXin LI # include <libintl.h>
2618fd37a7SXin LI 
2718fd37a7SXin LI #else
2818fd37a7SXin LI 
2918fd37a7SXin LI /* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
3018fd37a7SXin LI    chokes if dcgettext is defined as a macro.  So include it now, to make
3118fd37a7SXin LI    later inclusions of <locale.h> a NOP.  We don't include <libintl.h>
3218fd37a7SXin LI    as well because people using "gettext.h" will not include <libintl.h>,
3318fd37a7SXin LI    and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
3418fd37a7SXin LI    is OK.  */
3518fd37a7SXin LI #if defined(__sun)
3618fd37a7SXin LI # include <locale.h>
3718fd37a7SXin LI #endif
3818fd37a7SXin LI 
3918fd37a7SXin LI /* Disabled NLS.
4018fd37a7SXin LI    The casts to 'const char *' serve the purpose of producing warnings
4118fd37a7SXin LI    for invalid uses of the value returned from these functions.
4218fd37a7SXin LI    On pre-ANSI systems without 'const', the config.h file is supposed to
4318fd37a7SXin LI    contain "#define const".  */
4418fd37a7SXin LI # define gettext(Msgid) ((const char *) (Msgid))
4518fd37a7SXin LI # define dgettext(Domainname, Msgid) ((const char *) (Msgid))
4618fd37a7SXin LI # define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
4718fd37a7SXin LI # define ngettext(Msgid1, Msgid2, N) \
4818fd37a7SXin LI     ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
4918fd37a7SXin LI # define dngettext(Domainname, Msgid1, Msgid2, N) \
5018fd37a7SXin LI     ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
5118fd37a7SXin LI # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
5218fd37a7SXin LI     ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
5318fd37a7SXin LI # define textdomain(Domainname) ((const char *) (Domainname))
5418fd37a7SXin LI # define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
5518fd37a7SXin LI # define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
5618fd37a7SXin LI 
5718fd37a7SXin LI #endif
5818fd37a7SXin LI 
5918fd37a7SXin LI /* A pseudo function call that serves as a marker for the automated
6018fd37a7SXin LI    extraction of messages, but does not call gettext().  The run-time
6118fd37a7SXin LI    translation is done at a different place in the code.
6218fd37a7SXin LI    The argument, String, should be a literal string.  Concatenated strings
6318fd37a7SXin LI    and other string expressions won't work.
6418fd37a7SXin LI    The macro's expansion is not parenthesized, so that it is suitable as
6518fd37a7SXin LI    initializer for static 'char[]' or 'const char[]' variables.  */
6618fd37a7SXin LI #define gettext_noop(String) String
6718fd37a7SXin LI 
6818fd37a7SXin LI #endif /* _LIBGETTEXT_H */
69