[gnumeric] Fix ngettext usage.



commit b949a1d09050730f0e90b4571a0ac58ec9e1482f
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Sun Jul 4 17:45:00 2010 -0600

    Fix ngettext usage.
    
    2010-07-04  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/sheet-control-gui.c (scg_objects_drag_commit): don't be cheesy, ie.
    	  use ngettext.

 ChangeLog               |    5 +++++
 NEWS                    |    1 +
 src/sheet-control-gui.c |   27 +++++++++++++++++++++++----
 3 files changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 97d9ba9..7926480 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-07-04  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* src/sheet-control-gui.c (scg_objects_drag_commit): don't be cheesy, ie.
+	  use ngettext.
+
+2010-07-04  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* schemas/gnumeric-dialogs.schemas.in: fix typo
 
 2010-07-01  Morten Welinder  <terra gnome org>
diff --git a/NEWS b/NEWS
index 70c3cf4..98aad9c 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Andreas:
 	* Improve horizontal fill. [#594193]
 	* Improve function syntax tooltips. [#623317]
 	* Add weekend specifier to WORKDAY and NETWORKDAYS. [#172458]
+	* Fix ngettext usage.
 
 Morten:
 	* Ask user to locate solver binaries when plain search fails.
diff --git a/src/sheet-control-gui.c b/src/sheet-control-gui.c
index 6a76acf..c53f717 100644
--- a/src/sheet-control-gui.c
+++ b/src/sheet-control-gui.c
@@ -2475,15 +2475,34 @@ scg_objects_drag_commit (SheetControlGUI *scg, int drag_type,
 			 gboolean created_objects)
 {
 	CollectObjectsData data;
+	int n;
+	char *text;
+
 	data.objects = data.anchors = NULL;
 	data.scg = scg;
 	g_hash_table_foreach (scg->selected_objects,
 		(GHFunc) cb_collect_objects_to_commit, &data);
+	n = g_slist_length (data.objects);
+	
+	if (created_objects) {
+		if (drag_type == 8)
+			/* xgettext : %d gives the number of objects. This is input to ngettext. */
+			text = g_strdup_printf (ngettext ("Duplicate %d Object", "Duplicate %d Objects", n), n); 
+		else
+			/* xgettext : %d gives the number of objects. This is input to ngettext. */
+			text = g_strdup_printf (ngettext ("Insert %d Object", "Insert %d Objects", n), n); 			
+	} else {
+		if (drag_type == 8)
+			/* xgettext : %d gives the number of objects. This is input to ngettext. */
+			text = g_strdup_printf (ngettext ("Move %d Object", "Move %d Objects", n), n); 
+		else
+			/* xgettext : %d gives the number of objects. This is input to ngettext. */
+			text = g_strdup_printf (ngettext ("Resize %d Object", "Resize %d Objects", n), n); 			
+	}
+	
 	cmd_objects_move (WORKBOOK_CONTROL (scg_wbcg (scg)),
-		data.objects, data.anchors, created_objects,
-		created_objects /* This is somewhat cheesy and should use ngettext */
-			? ((drag_type == 8) ? _("Duplicate Object") : _("Insert Object"))
-			: ((drag_type == 8) ? _("Move Object")	    : _("Resize Object")));
+		data.objects, data.anchors, created_objects, text);
+	g_free (text);
 }
 
 void



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