diff src/util.c @ 4834:0ed37c803503

[gaim-migrate @ 5159] Bjoern Voigt writes: "I resolved the conflicts and added a new patch in the attachment. Besides this updates | I have updated the German translation and fixed some i18n bugs. Most | interesting is, that the new Gaim main menu now can be translated. As | a quick fix I added a new item_factory_translate_func function to | buddy.c. Now there are 2 static item_factory_translate_func functions | in buddy.c and gtkconv.c. If you are interested, I can clean this next | time (only one global function in gaim.h and utils.c). | The other i18n fixed mark some strings as translatable, for instance | in the "Get Buddy Info" message boxes. I included an i18n fix for src/util.c:for sec_to_text (seconds to text)." committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Wed, 19 Mar 2003 23:07:52 +0000
parents 677d3cb193a1
children fbfdacf7c611
line wrap: on
line diff
--- a/src/util.c	Wed Mar 19 22:31:05 2003 +0000
+++ b/src/util.c	Wed Mar 19 23:07:52 2003 +0000
@@ -92,7 +92,7 @@
 
 gchar *sec_to_text(guint sec)
 {
-	int daze, hrs, min;
+	guint daze, hrs, min;
 	char *ret = g_malloc(256);
 
 	daze = sec / (60 * 60 * 24);
@@ -105,32 +105,32 @@
 			if (hrs) {
 				if (min) {
 					g_snprintf(ret, 256,
-						   "%d day%s, %d hour%s, %d minute%s.",
-						   daze, daze == 1 ? "" : "s",
-						   hrs, hrs == 1 ? "" : "s", min, min == 1 ? "" : "s");
+						   "%d %s, %d %s, %d %s.",
+						   daze, ngettext("day","days",daze),
+						   hrs, ngettext("hour","hours",hrs), min, ngettext("minute","minutes",min));
 				} else {
 					g_snprintf(ret, 256,
-						   "%d day%s, %d hour%s.",
-						   daze, daze == 1 ? "" : "s", hrs, hrs == 1 ? "" : "s");
+						   "%d %s, %d %s.",
+						   daze, ngettext("day","days",daze), hrs, ngettext("hour","hours",hrs));
 				}
 			} else {
 				g_snprintf(ret, 256,
-					   "%d day%s, %d minute%s.",
-					   daze, daze == 1 ? "" : "s", min, min == 1 ? "" : "s");
+					   "%d %s, %d %s.",
+					   daze, ngettext("day","days",daze), min, ngettext("minute","minutes",min));
 			}
 		} else
-			g_snprintf(ret, 256, "%d day%s.", daze, daze == 1 ? "" : "s");
+			g_snprintf(ret, 256, "%d %s.", daze, ngettext("day","days",daze));
 	} else {
 		if (hrs) {
 			if (min) {
 				g_snprintf(ret, 256,
-					   "%d hour%s, %d minute%s.",
-					   hrs, hrs == 1 ? "" : "s", min, min == 1 ? "" : "s");
+					   "%d %s, %d %s.",
+					   hrs, ngettext("hour","hours",hrs), min, ngettext("minute","minutes",min));
 			} else {
-				g_snprintf(ret, 256, "%d hour%s.", hrs, hrs == 1 ? "" : "s");
+				g_snprintf(ret, 256, "%d %s.", hrs, ngettext("hour","hours",hrs));
 			}
 		} else {
-			g_snprintf(ret, 256, "%d minute%s.", min, min == 1 ? "" : "s");
+			g_snprintf(ret, 256, "%d %s.", min, ngettext("minute","minutes",min));
 		}
 	}