]> code.citadel.org Git - citadel.git/commitdiff
* More gettext/i18n crap
authorArt Cancro <ajc@citadel.org>
Tue, 16 Aug 2005 20:51:08 +0000 (20:51 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 16 Aug 2005 20:51:08 +0000 (20:51 +0000)
webcit/ChangeLog
webcit/gettext.h [new file with mode: 0644]
webcit/webcit.h
webcit/webserver.c

index 011193f84108ab0d503cddfc8ccea94c605aa1ad..49e5fd0a6c118e608bda6e9accb7ffdd176e8ed8 100644 (file)
@@ -1,8 +1,10 @@
-2005-08-16  gettextize  <bug-gnu-gettext@gnu.org>
+$Log$
+Revision 621.8  2005/08/16 20:51:08  ajc
+* More gettext/i18n crap
 
-       * configure.in (AC_OUTPUT): Add intl/Makefile,
+2005-08-16  gettextize  <bug-gnu-gettext@gnu.org>
+* configure.in (AC_OUTPUT): Add intl/Makefile,
 
-$Log$
 Revision 621.7  2005/08/16 20:14:25  ajc
 * This is an attempt to gettextize the WebCit build.
 
@@ -2817,4 +2819,3 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
-
diff --git a/webcit/gettext.h b/webcit/gettext.h
new file mode 100644 (file)
index 0000000..8b262f4
--- /dev/null
@@ -0,0 +1,69 @@
+/* Convenience header for conditional use of GNU <libintl.h>.
+   Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify it
+   under the terms of the GNU Library General Public License as published
+   by the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.  */
+
+#ifndef _LIBGETTEXT_H
+#define _LIBGETTEXT_H 1
+
+/* NLS can be disabled through the configure --disable-nls option.  */
+#if ENABLE_NLS
+
+/* Get declarations of GNU message catalog functions.  */
+# include <libintl.h>
+
+#else
+
+/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
+   chokes if dcgettext is defined as a macro.  So include it now, to make
+   later inclusions of <locale.h> a NOP.  We don't include <libintl.h>
+   as well because people using "gettext.h" will not include <libintl.h>,
+   and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
+   is OK.  */
+#if defined(__sun)
+# include <locale.h>
+#endif
+
+/* Disabled NLS.
+   The casts to 'const char *' serve the purpose of producing warnings
+   for invalid uses of the value returned from these functions.
+   On pre-ANSI systems without 'const', the config.h file is supposed to
+   contain "#define const".  */
+# define gettext(Msgid) ((const char *) (Msgid))
+# define dgettext(Domainname, Msgid) ((const char *) (Msgid))
+# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
+# define ngettext(Msgid1, Msgid2, N) \
+    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
+# define dngettext(Domainname, Msgid1, Msgid2, N) \
+    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
+# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
+    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
+# define textdomain(Domainname) ((const char *) (Domainname))
+# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
+# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
+
+#endif
+
+/* A pseudo function call that serves as a marker for the automated
+   extraction of messages, but does not call gettext().  The run-time
+   translation is done at a different place in the code.
+   The argument, String, should be a literal string.  Concatenated strings
+   and other string expressions won't work.
+   The macro's expansion is not parenthesized, so that it is suitable as
+   initializer for static 'char[]' or 'const char[]' variables.  */
+#define gettext_noop(String) String
+
+#endif /* _LIBGETTEXT_H */
index 7274f78940e7b2bc24ffa8135bbd8af7193eb029..c28db030f87ed9cf7a6664abc418a19b4c4cb918 100644 (file)
 #endif
 
 
+#ifdef ENABLE_NLS
+#ifdef HAVE_LIBINTL_H
+#include <libintl.h>
+#endif
+#define _(string) gettext(string)
+#define P_(singular, plural, number) ngettext(singular, plural, number)
+#else
+#define _(string) (string)
+#define P_(singular, plural, number) (number == 1 ? singular : plural)
+#endif
+#define gettext_noop(string) (string)
+#define N_(string) gettext_noop(string)
+        /* Mark a string that will be sent to gettext() later. */
+
+
 /*
  * Uncomment to dump an HTTP trace to stderr
 #define HTTP_TRACING 1
index 68e3bb17c8d8a013c254d91e960965b8b66a05aa..a7510d03798d6446464d0b74eda090585e298ec1 100644 (file)
@@ -442,13 +442,13 @@ int main(int argc, char **argv)
                        ctdlport = argv[optind];
        }
        /* Tell 'em who's in da house */
-       lprintf(1, SERVER "\n"
-               "Copyright (C) 1996-2005 by the Citadel development team.\n"
+       lprintf(1, SERVER "\n");
+       lprintf(1, _("Copyright (C) 1996-2005 by the Citadel development team.\n"
                "This software is distributed under the terms of the "
-               "GNU General Public License.\n\n"
+               "GNU General Public License.\n\n")
        );
 
-       lprintf(9, "Changing directory to %s\n", webcitdir);
+       lprintf(9, _("Changing directory to %s\n"), webcitdir);
        if (chdir(webcitdir) != 0) {
                perror("chdir");
        }