[rhythmbox] fix missing plural handling for various strings (bug #659467)



commit 701b303b9ee9d7991a5cf1b5decd91afc11891f7
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sat Jan 7 09:47:23 2012 +1000

    fix missing plural handling for various strings (bug #659467)

 plugins/context/tmpl/album-tmpl.html |    6 ++++--
 shell/rb-track-transfer-queue.c      |   34 ++++++++++++++++------------------
 sources/rb-import-errors-source.c    |    2 +-
 3 files changed, 21 insertions(+), 21 deletions(-)
---
diff --git a/plugins/context/tmpl/album-tmpl.html b/plugins/context/tmpl/album-tmpl.html
index c718417..b8860c6 100644
--- a/plugins/context/tmpl/album-tmpl.html
+++ b/plugins/context/tmpl/album-tmpl.html
@@ -4,6 +4,7 @@
     import re
     import cgi
     import rfc822
+    from gettext import ngettext
 
     def cleanup(text):
         return re.sub(r'\([^\)]*\)', '', text)
@@ -71,9 +72,10 @@
     %if 'duration' in entry:
     <% 
         album_time = sec2hms(entry['duration'])
-        tracks = len(entry['tracklist'])
+	tracks = len(entry['tracklist'])
+	str = ngettext("%s (%d track)", "%s (%d tracks)", tracks)
     %>
-    <p class="duration">${ _("%s (%d tracks)") % (album_time, tracks) }</p>
+    <p class="duration">${ str % (album_time, tracks) }</p>
     %endif
     %if 'tracklist' in entry:
     <button id="btn_${entry['id'] | h}" onclick="toggle_vis(${entry['id'] | h})">
diff --git a/shell/rb-track-transfer-queue.c b/shell/rb-track-transfer-queue.c
index c2e7e12..0f63a7b 100644
--- a/shell/rb-track-transfer-queue.c
+++ b/shell/rb-track-transfer-queue.c
@@ -416,16 +416,15 @@ start_next_batch (RBTrackTransferQueue *queue)
 	}
 
 	if (profiles == NULL) {
-		if (total == 1) {
-			message = g_strdup (_("This file cannot be transferred as it is not in a "
-					      "format supported by the target device and no suitable "
-					      "encoding profiles are available."));
-		} else {
-			message = g_strdup_printf (_("%d of the %d files cannot be transferred as "
-						     "they must be converted into a format supported "
-						     "by the target device but no suitable encoding "
-						     "profiles are available."), count, total);
-		}
+		const char *str;
+		str = ngettext ("%d file cannot be transferred as it must be converted into "
+				"a format supported by the target device but no suitable "
+				"encoding profiles are available",
+				"%d files cannot be transferred as they must be converted into "
+				"a format supported by the target device but no suitable "
+				"encoding profiles are available",
+				count);
+		message = g_strdup_printf (str, count);
 	} else {
 		GPtrArray *descriptions;
 		GstEncodingTarget *target;
@@ -444,15 +443,14 @@ start_next_batch (RBTrackTransferQueue *queue)
 			/* XXX should provide the option of picking a different format? */
 			message = g_strdup_printf (_("Additional software is required to encode media "
 						     "in your preferred format:\n%s"), plugins);
-		} else if (total == 1) {
-			message = g_strdup_printf (_("Additional software is required to convert this "
-						     "file into a format supported by the target "
-						     "device:\n%s"), plugins);
 		} else {
-			message = g_strdup_printf (_("Additional software is required to convert %d "
-						     "of the %d files to be transferred into a format "
-						     "supported by the target device:\n%s"),
-						     count, total, plugins);
+			const char *str;
+			str = ngettext ("Additional software is required to convert %d file "
+					"into a format supported by the target device:\n%s",
+					"Additional software is required to convert %d files "
+					"into a format supported by the target device:\n%s",
+					count);
+			message = g_strdup_printf (str, count, plugins);
 		}
 
 		g_free (plugins);
diff --git a/sources/rb-import-errors-source.c b/sources/rb-import-errors-source.c
index e88f437..7e3de77 100644
--- a/sources/rb-import-errors-source.c
+++ b/sources/rb-import-errors-source.c
@@ -388,7 +388,7 @@ impl_get_status (RBDisplayPage *page, char **text, char **progress_text, float *
 	count = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL);
 	g_object_unref (model);
 
-	*text = g_strdup_printf (ngettext ("%d import errors", "%d import errors", count),
+	*text = g_strdup_printf (ngettext ("%d import error", "%d import errors", count),
 				 count);
 }
 



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