[gnumeric] Address translator concerns [#660959]



commit 2af9f870fea4ae058879e892338a25313ba18e3b
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Wed Oct 5 15:46:45 2011 -0600

    Address translator concerns [#660959]
    
    2011-10-05 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/undo.c (gnm_undo_filter_set_condition_undo): fix error in
    	label text, split label creation and add translator comments
    	* src/item-bar.c (colrow_tip_setlabel): create label attempting to
    	provide correct plurals and add translator comments

 ChangeLog      |    7 +++++++
 src/item-bar.c |   30 +++++++++++++++++++-----------
 src/undo.c     |   25 +++++++++++++++++++------
 3 files changed, 45 insertions(+), 17 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 52e3a25..b0493f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-10-05 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* src/undo.c (gnm_undo_filter_set_condition_undo): fix error in
+	label text, split label creation and add translator comments
+	* src/item-bar.c (colrow_tip_setlabel): create label attempting to
+	provide correct plurals and add translator comments
+
 2011-09-30 Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* src/collect.c (collect_float_pairs): check whetehr these are
diff --git a/src/item-bar.c b/src/item-bar.c
index 5c2882d..1e585c0 100644
--- a/src/item-bar.c
+++ b/src/item-bar.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8: */
+/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
  * A canvas item implementing row/col headers with support for outlining.
  *
@@ -781,18 +781,26 @@ static void
 colrow_tip_setlabel (ItemBar *ib, gboolean const is_cols, int size_pixels)
 {
 	if (ib->tip != NULL) {
-		char *buffer;
+		char *buffer, *points, *pixels;
+		char const *label = is_cols ? _("Width:") : _("Height");
 		double const scale = 72. / gnm_app_display_dpi_get (!is_cols);
-		if (is_cols)
-			buffer = g_strdup_printf (ngettext ("Width: %.2f pts (%d pixel)",
-							"Width: %.2f pts (%d pixels)",
-							size_pixels),
-						  scale*size_pixels, size_pixels);
+		double size_points = scale*size_pixels;
+		
+		/* xgettext: This is input to ngettext based on the number of pixels. */
+		pixels = g_strdup_printf (ngettext ("(%d pixel)", "(%d pixels)", size_pixels),
+					  size_pixels);
+		
+		if (size_points == gnm_floor (size_points))
+			/* xgettext: This is input to ngettext based on the integer number of points. */
+			points = g_strdup_printf (ngettext (_("%d.00 pt"), _("%d.00 pts"), (int) gnm_floor (size_points)),
+						  (int) gnm_floor (size_points));
 		else
-			buffer = g_strdup_printf (ngettext ("Height: %.2f pts (%d pixel)",
-							"Height: %.2f pts (%d pixels)",
-							size_pixels),
-						  scale*size_pixels, size_pixels);
+			/* xgettext: The number of points here is always a fractional number, ie. not an integer. */
+			points = g_strdup_printf (_("%.2f pts"), size_points);
+
+		buffer = g_strconcat (label, " ", points, " ", pixels, NULL);
+		g_free (pixels);
+		g_free (points);
 		gtk_label_set_text (GTK_LABEL (ib->tip), buffer);
 		g_free(buffer);
 	}
diff --git a/src/undo.c b/src/undo.c
index de8d2dd..62614c1 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -234,12 +234,25 @@ gnm_undo_filter_set_condition_undo (GOUndo *u, gpointer data)
 			ua->filter->r.end.row,
 			(ColRowHandler) cb_filter_set_condition_undo,
 			&count);
-	format = ngettext ("%d row of %d match",
-			   "%d rows of %d match",
-			   count);
-	text = g_strdup_printf (format, count,
-				ua->filter->r.end.row -
-				ua->filter->r.start.row);
+	if (ua->filter->r.end.row - ua->filter->r.start.row > 10) {
+		/* xgettext: The first %d gives the number of rows that match. */
+		/* The second %d gives the total number of rows. Assume that the */
+		/* total number of rows is always large (>10). */
+		/* This is input to ngettext. */
+		format = ngettext ("%d row of %d matches",
+				   "%d rows of %d match",
+				   count);
+		text = g_strdup_printf (format, count,
+					ua->filter->r.end.row -
+					ua->filter->r.start.row);
+	} else {
+		/* xgettext: The %d gives the number of rows that match. */
+		/* This is input to ngettext. */
+		format = ngettext ("%d row matches",
+				   "%d rows match",
+				   count);		
+		text = g_strdup_printf (format, count);
+	}
 
 	SHEET_FOREACH_CONTROL (ua->filter->sheet, view, control, cb_filter_set_condition_undo_set_pb (control, text););
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]