Re: Patch for I18N support: how to incorporate?
Jan-Oliver Wagner <[email protected]>
| Newsgroups | gmane.comp.security.nessus.devel |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Aug 17, 2004 at 11:53:32PM +0200, Renaud Deraison wrote: > On Tue, Aug 17, 2004 at 03:32:27PM +0200, Jan-Oliver Wagner wrote: > > 2. Should I split up the patch into a series of > > small patches to test separately? and here is the second an third patch: nessus-i18n-patch2.tar.gz: Not actually a patch, but an archive of the new directory 'po'. Just extract in nessus-core. This patch is not harmful as the directory will only be there. The commands as described in the README will not work until the third patch is applied. nessus-i18n-patch3: Apply in nessus-core. This is the patch that activitates the I18N support. However, actually it defines only some variables and adds a test for GNU gettext. To my best understanding, this test should work well on any system. But of course I don't have access to any type of system and thus it needs testing and feedback. Attached is also an extended ChangLog file which describes the changes in all 3 patches. Note, that I18N suport is not build automatically. So far, you have to follow po/README. Autmatically bulding means even more testing so I avoided this for the moment. My next patch would be to mark all strings in nessus-core/nessus with _(). Naturally, that will be a more comprehensive patch. Best Jan -- Jan-Oliver Wagner http://intevation.de/~jan/ Intevation GmbH http://intevation.de/ FreeGIS http://freegis.org/ _______________________________________________ Nessus-devel mailing list [email protected] http://mail.nessus.org/mailman/listinfo/nessus-devel
ChangeLog
(text/plain, 1.4 KB)
2004-08-18 Jan-Oliver Wagner <[email protected]> Add I18N support to configure.in and nessus.tmpl.in. configure.in: Added test for GNU gettext. Introduced variable gettext_flags to transfer result. nessus.tmpl.in (localdir, VERSION, USE_GNU_GETTEXT): New Variables. (NESSUS_DEFS): Added USE_GNU_GETTEXT. 2004-08-18 Jan-Oliver Wagner <[email protected]> Add the I18N po directory with its components and a sample translation to german for a single string marked already in nessus/nessus.c. po: New directory. po/README: New. How to create and updated translations. po/Makefile: All the rules to build, update and install the translation files. po/POTFILES: New. A list of the files that are scanned for strings to translate. po/de.po: New. Covers a single sample string so far. Note, that this file is encoded in UTF-8! po/remove-potcdate.sin: New. Script to handle POT Dates. 2004-08-18 Jan-Oliver Wagner <[email protected]> Introduce I18N support. Only one string marked so far for testing. * nessus/Makefile (cflags): Added definition of PACKAGE=nessus for gettext. * nessus/nessus.h: Added definition of function _() depending on whether gettext is available or not. In the latter case _(a) is just (a). * nessus/nessus.c (i18n_init): New. Binds the text domain in case gettext is available. (main): Call i18n_init() right after start. Applied _() to a single sample string.
nessus-i18n-patch2.tar.gz
(application/octet-stream, 5.7 KB) - not displayed
nessus-i18n-patch3
(text/plain, 2.1 KB)
Index: configure.in
===================================================================
RCS file: /usr/local/cvs/nessus-core/configure.in,v
retrieving revision 1.123
diff -u -3 -p -r1.123 configure.in
--- configure.in 21 Jul 2004 21:03:50 -0000 1.123
+++ configure.in 18 Aug 2004 09:56:33 -0000
@@ -383,6 +383,20 @@ AC_TRY_COMPILE([#include <sys/types.h>
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TCPHDR_TH_X2_OFF)],
[AC_MSG_RESULT(no)])
+dnl I18N Test (GNU gettext)
+AC_MSG_CHECKING([GNU gettext available])
+AC_TRY_COMPILE([#include <libintl.h>],
+[extern int _nl_msg_cat_cntr;
+extern int *_nl_domain_bindings;
+int
+main ()
+{
+ bindtextdomain ("", "");
+ return (int) gettext ("") + (int) ngettext ("", "", 0) + _nl_msg_cat_cntr + *_nl_domain_bindings;
+}],
+[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_GNU_GETTEXT) gettext_flags="-DHAVE_GNU_GETTEXT"],
+[AC_MSG_RESULT(no)])
+
dnl Define several paths
@@ -792,6 +806,7 @@ AC_SUBST(ac_configure_args)
AC_SUBST(egdpath)
AC_SUBST(is_cygwin)
AC_SUBST(installuser)
+AC_SUBST(gettext_flags)
dnl And we put everything in the appropriate files
Index: nessus.tmpl.in
===================================================================
RCS file: /usr/local/cvs/nessus-core/nessus.tmpl.in,v
retrieving revision 1.35
diff -u -3 -p -r1.35 nessus.tmpl.in
--- nessus.tmpl.in 21 Jan 2003 10:52:47 -0000 1.35
+++ nessus.tmpl.in 18 Aug 2004 09:56:33 -0000
@@ -41,6 +41,9 @@ include= -I. -I$(rootdir)/include
INSTALL=@INSTALL@
INSTALL_DIR=@INSTALL_DIR@
installuser=@installuser@
+localedir=$(datadir)/locale
+
+VERSION=@NESSUS_MAJOR@.@NESSUS_MINOR@.@NESSUS_PATCH@
# Nessus specific
NESSUSD_CONFDIR=@NESSUSD_CONFDIR@
@@ -101,6 +104,9 @@ USE_PTHREADS=@use_pthreads@
USE_GTK = @gtk_flags@
+# Is GNU Gettext available?
+USE_GNU_GETTEXT = @gettext_flags@ -DLOCALEDIR=\"$(localedir)\"
+
# Build with debugging ?
DEBUG = @debug_flags@
@@ -108,7 +114,7 @@ DEBUG = @debug_flags@
USE_LIBWRAP = @uselibwrap@
# Some defines you may want to modify
-NESSUS_DEFS=@DEFS@ $(USE_PTHREADS) $(DEBUG) $(USE_GTK) $(USE_LIBWRAP)
+NESSUS_DEFS=@DEFS@ $(USE_PTHREADS) $(DEBUG) $(USE_GTK) $(USE_LIBWRAP) $(USE_GNU_GETTEXT)
DEFS=
LDFLAGS=