2004-03-17  Danilo Šegan  <dsegan@gmx.net>

	* filter-datespec.c (set_button): Use ngettext for handling plurals.
	(timespans): Use C preprocessor hacks to make xgettext see real
	ngettext messages.

--- filter/filter-datespec.c.~1.34.~	Wed Mar 17 14:59:30 2004
+++ filter/filter-datespec.c	Wed Mar 17 15:05:26 2004
@@ -61,16 +61,26 @@
 	float max;
 } timespan;
 
+#ifdef ngettext
+#undef ngettext
+#endif
+
+/* This is a nasty hack trying to keep both ngettext function and xgettext tool happy */
+/* It *will* cause problems if ngettext is a macro */
+#define ngettext(a, b)  a, b
 static const timespan timespans[] = {
-	{ 1, N_("1 second ago"), N_("%d seconds ago"), 59.0 },
-	{ 60, N_("1 minute ago"), N_("%d minutes ago"), 59.0 },
-	{ 3600, N_("1 hour ago"), N_("%d hours ago"), 23.0 },
-	{ 86400, N_("1 day ago"), N_("%d days ago"), 31.0 },
-	{ 604800, N_("1 week ago"), N_("%d weeks ago"), 52.0 },
-	{ 2419200, N_("1 month ago"), N_("%d months ago"), 12.0 },
-	{ 31557600, N_("1 year ago"), N_("%d years ago"), 1000.0 },
+	{ 1, ngettext("1 second ago", "%d seconds ago"), 59.0 },
+	{ 60, ngettext("1 minute ago", "%d minutes ago"), 59.0 },
+	{ 3600, ngettext("1 hour ago", "%d hours ago"), 23.0 },
+	{ 86400, ngettext("1 day ago", "%d days ago"), 31.0 },
+	{ 604800, ngettext("1 week ago", "%d weeks ago"), 52.0 },
+	{ 2419200, ngettext("1 month ago", "%d months ago"), 12.0 },
+	{ 31557600, ngettext("1 year ago", "%d years ago"), 1000.0 },
 };
 
+/* now we let the compiler see the real function call */
+#undef ngettext
+
 #define DAY_INDEX 3
 #define N_TIMESPANS (sizeof (timespans) / sizeof (timespans[0]))
 
@@ -294,12 +304,7 @@
 			span = get_best_span(fds->value);
 			count = fds->value / timespans[span].seconds;
 			
-			if (count == 1)
-				/* 1 (minute|day|...) ago (singular time ago) */
-				strcpy(buf, _(timespans[span].singular));
-			else
-				/* N (minutes|days|...) ago (plural time ago) */
-				sprintf(buf, _(timespans[span].plural), count);
+			sprintf(buf, ngettext(timespans[span].singular, timespans[span].plural, count), count);
 		}
 		break;
 	}
