2 * Copyright (c) 2011 Todd C. Miller <Todd.Miller@courtesan.com>
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #ifndef _SUDO_GETTEXT_H
18 #define _SUDO_GETTEXT_H
21 * Solaris locale.h includes libintl.h which causes problems when we
22 * redefine the gettext functions. We include it first to avoid this.
24 #if defined(HAVE_SETLOCALE) && defined(__sun__) && defined(__svr4__)
33 * If DEFAULT_TEXT_DOMAIN is defined, use its value as the domain for
34 * gettext() and ngettext() instead of the value set by textdomain().
35 * This is used by the sudoers plugin as well as the convenience libraries.
37 # ifdef DEFAULT_TEXT_DOMAIN
39 # define gettext(String) \
40 dgettext(DEFAULT_TEXT_DOMAIN, String)
42 # define ngettext(String, String_Plural, N) \
43 dngettext(DEFAULT_TEXT_DOMAIN, String, String_Plural, N)
47 * Older versions of Solaris lack ngettext() so we have to kludge it.
49 # ifndef HAVE_NGETTEXT
51 # define ngettext(String, String_Plural, N) \
52 ((N) == 1 ? gettext(String) : gettext(String_Plural))
55 /* Gettext convenience macros */
56 # define _(String) gettext(String)
57 # define gettext_noop(String) String
58 # define N_(String) gettext_noop(String)
60 #else /* !HAVE_LIBINTL_H */
63 * Internationalization is either unavailable or has been disabled.
64 * Define away the gettext functions used by sudo.
66 # define _(String) String
67 # define N_(String) String
68 # define textdomain(Domain)
69 # define bindtextdomain(Package, Directory)
70 # define ngettext(String, String_Plural, N) \
71 ((N) == 1 ? (String) : (String_Plural))
73 #endif /* HAVE_LIBINTL_H */
75 #endif /* _SUDO_GETTEXT_H */