second attempt at ngettext() fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1318 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2002-11-04 16:12:19 +00:00
parent 0084eaa9e0
commit 99519ae375
4 changed files with 11 additions and 14 deletions

View File

@ -6,6 +6,9 @@ CVS code -
$SYSCONFDIR/nanorc but not ~/.nanorc. (DLR) $SYSCONFDIR/nanorc but not ~/.nanorc. (DLR)
- Change all references to /etc/nanorc in the documentation to - Change all references to /etc/nanorc in the documentation to
$SYSCONFDIR/nanorc. (DLR) $SYSCONFDIR/nanorc. (DLR)
- Minor cosmetic tweaks to the ngettext() macro, and fix to
properly detect systems lacking ngettext() and correctly
compile on them; the previous fix didn't work. (DLR)
nano.c: nano.c:
version() version()
- Remove obsolete reference to --enable-undo. (David Benbennick) - Remove obsolete reference to --enable-undo. (David Benbennick)

View File

@ -223,11 +223,7 @@ AC_MSG_WARN([*** Can not use slang when cross-compiling])),
esac], [AC_MSG_RESULT(no)]) esac], [AC_MSG_RESULT(no)])
dnl Checks for functions dnl Checks for functions
AC_CHECK_FUNCS(ngettext snprintf vsnprintf) AC_CHECK_FUNCS(snprintf vsnprintf)
if test "x$ac_cv_func_ngettext" = "xno"
then
AC_DEFINE(NO_NGETTEXT, 1, [Defined if ngettext() is unavailable])
fi
if test "x$ac_cv_func_snprintf" = "xno" -o "xac_cv_func_vsnprintf" = "xno" if test "x$ac_cv_func_snprintf" = "xno" -o "xac_cv_func_vsnprintf" = "xno"
then then
AM_PATH_GLIB(1.2.4,, AM_PATH_GLIB(1.2.4,,
@ -319,7 +315,7 @@ then
fi fi
dnl i18n stuff - pretty incomplete for now dnl i18n stuff - pretty incomplete for now
AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT([external], [need-ngettext])
AC_CONFIG_FILES([Makefile m4/Makefile po/Makefile.in nano.spec]) AC_CONFIG_FILES([Makefile m4/Makefile po/Makefile.in nano.spec])
AC_OUTPUT AC_OUTPUT

View File

@ -301,16 +301,16 @@ int read_file(FILE *f, const char *filename, int quiet)
#ifndef NANO_SMALL #ifndef NANO_SMALL
if (fileformat == 2) if (fileformat == 2)
statusbar(ngettext("Read %d line (Converted from Mac format)", statusbar(__("Read %d line (Converted from Mac format)",
"Read %d lines (Converted from Mac format)", "Read %d lines (Converted from Mac format)",
num_lines), num_lines); num_lines), num_lines);
else if (fileformat == 1) else if (fileformat == 1)
statusbar(ngettext("Read %d line (Converted from DOS format)", statusbar(__("Read %d line (Converted from DOS format)",
"Read %d lines (Converted from DOS format)", "Read %d lines (Converted from DOS format)",
num_lines), num_lines); num_lines), num_lines);
else else
#endif #endif
statusbar(ngettext("Read %d line", "Read %d lines", num_lines), statusbar(__("Read %d line", "Read %d lines", num_lines),
num_lines); num_lines);
totlines += num_lines; totlines += num_lines;
@ -1646,7 +1646,7 @@ int write_file(const char *name, int tmp, int append, int nonamechange)
/* Update originalfilestat to reference the file as it is now. */ /* Update originalfilestat to reference the file as it is now. */
stat(filename, &originalfilestat); stat(filename, &originalfilestat);
#endif #endif
statusbar(ngettext("Wrote %d line", "Wrote %d lines", lineswritten), statusbar(__("Wrote %d line", "Wrote %d lines", lineswritten),
lineswritten); lineswritten);
UNSET(MODIFIED); UNSET(MODIFIED);
titlebar(NULL); titlebar(NULL);

6
nano.h
View File

@ -51,12 +51,10 @@
# include <libintl.h> # include <libintl.h>
# endif # endif
# define _(string) gettext(string) # define _(string) gettext(string)
# ifdef NO_NGETTEXT # define __(singular, plural, number) ngettext(singular, plural, number)
# define ngettext(singular, plural, number) gettext(number == 1 ? singular : plural)
# endif
#else #else
# define _(string) (string) # define _(string) (string)
# define ngettext(singular, plural, number) number == 1 ? singular : plural # define __(singular, plural, number) (number == 1 ? singular : plural)
#endif #endif
#include <sys/types.h> #include <sys/types.h>