comparison 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
comparison
equal deleted inserted replaced
4833:a6960b4b0c9b 4834:0ed37c803503
90 } 90 }
91 91
92 92
93 gchar *sec_to_text(guint sec) 93 gchar *sec_to_text(guint sec)
94 { 94 {
95 int daze, hrs, min; 95 guint daze, hrs, min;
96 char *ret = g_malloc(256); 96 char *ret = g_malloc(256);
97 97
98 daze = sec / (60 * 60 * 24); 98 daze = sec / (60 * 60 * 24);
99 hrs = (sec % (60 * 60 * 24)) / (60 * 60); 99 hrs = (sec % (60 * 60 * 24)) / (60 * 60);
100 min = (sec % (60 * 60)) / 60; 100 min = (sec % (60 * 60)) / 60;
103 if (daze) { 103 if (daze) {
104 if (hrs || min) { 104 if (hrs || min) {
105 if (hrs) { 105 if (hrs) {
106 if (min) { 106 if (min) {
107 g_snprintf(ret, 256, 107 g_snprintf(ret, 256,
108 "%d day%s, %d hour%s, %d minute%s.", 108 "%d %s, %d %s, %d %s.",
109 daze, daze == 1 ? "" : "s", 109 daze, ngettext("day","days",daze),
110 hrs, hrs == 1 ? "" : "s", min, min == 1 ? "" : "s"); 110 hrs, ngettext("hour","hours",hrs), min, ngettext("minute","minutes",min));
111 } else { 111 } else {
112 g_snprintf(ret, 256, 112 g_snprintf(ret, 256,
113 "%d day%s, %d hour%s.", 113 "%d %s, %d %s.",
114 daze, daze == 1 ? "" : "s", hrs, hrs == 1 ? "" : "s"); 114 daze, ngettext("day","days",daze), hrs, ngettext("hour","hours",hrs));
115 } 115 }
116 } else { 116 } else {
117 g_snprintf(ret, 256, 117 g_snprintf(ret, 256,
118 "%d day%s, %d minute%s.", 118 "%d %s, %d %s.",
119 daze, daze == 1 ? "" : "s", min, min == 1 ? "" : "s"); 119 daze, ngettext("day","days",daze), min, ngettext("minute","minutes",min));
120 } 120 }
121 } else 121 } else
122 g_snprintf(ret, 256, "%d day%s.", daze, daze == 1 ? "" : "s"); 122 g_snprintf(ret, 256, "%d %s.", daze, ngettext("day","days",daze));
123 } else { 123 } else {
124 if (hrs) { 124 if (hrs) {
125 if (min) { 125 if (min) {
126 g_snprintf(ret, 256, 126 g_snprintf(ret, 256,
127 "%d hour%s, %d minute%s.", 127 "%d %s, %d %s.",
128 hrs, hrs == 1 ? "" : "s", min, min == 1 ? "" : "s"); 128 hrs, ngettext("hour","hours",hrs), min, ngettext("minute","minutes",min));
129 } else { 129 } else {
130 g_snprintf(ret, 256, "%d hour%s.", hrs, hrs == 1 ? "" : "s"); 130 g_snprintf(ret, 256, "%d %s.", hrs, ngettext("hour","hours",hrs));
131 } 131 }
132 } else { 132 } else {
133 g_snprintf(ret, 256, "%d minute%s.", min, min == 1 ? "" : "s"); 133 g_snprintf(ret, 256, "%d %s.", min, ngettext("minute","minutes",min));
134 } 134 }
135 } 135 }
136 136
137 return ret; 137 return ret;
138 } 138 }