Re: [evolution-patches] Patch for translation-issues in save-calendar plugin (#73099)



On Mon, 2005-02-28 at 16:19 +0100, Philip Van Hoof wrote:
> On Mon, 2005-02-28 at 16:16 +0100, Philip Van Hoof wrote:
> > 
> > This one needs revision/approval. After receiving, I'll commit as
> > user pvanhoof.
> > 
> >     http://bugzilla.ximian.com/show_bug.cgi?id=73099
> > 
> > View the patch here:
> > http://bugzilla.ximian.com/showattachment.cgi?attach_id=14449
> 
> Forgot to do the g_data_free () thing .. new one:
> 
> http://bugzilla.ximian.com/showattachment.cgi?attach_id=14450
> 

This makes it a little tricky to comment on inline, however:

Index: csv-format.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/save-calendar/csv-format.c,v
retrieving revision 1.3
diff -u -r1.3 csv-format.c
--- csv-format.c	4 Jan 2005 11:52:21 -0000	1.3
+++ csv-format.c	28 Feb 2005 15:26:01 -0000
@@ -155,25 +155,37 @@
 static GString *
 add_time_to_csv (GString *line, icaltimetype *time, CsvConfig *config)
 {
-	/*
-	 * Perhaps we should check for quotes, delimiter and newlines in the
-	 * resulting string: The translators can put it there!
-	 *
-	 * Or perhaps we shouldn't make this translatable?
-	 * Or perhaps there is a library-function to do this?
-	 */
 
 	if (time) {
-		g_string_append_printf (line, _("%s%d/%s%d/%s%d %s%d:%s%d:%s%d"), 
-					(time->month < 10)?"0":"", time->month, 
-					(time->day < 10)?"0":"", time->day, 
-					(time->year < 10)?"0":"", time->year, 
-					(time->hour < 10)?"0":"", time->hour, 
-					(time->minute < 10)?"0":"", time->minute, 
-					(time->second < 10)?"0":"", time->second);
+		gboolean needquotes = FALSE;
+		struct tm mytm;
+		GDate *date = g_date_new_dmy (time->day, time->month, time->year);
+		char *str = (char*) malloc (sizeof (char) * 200);
+		
+		g_date_to_struct_tm (date, &mytm);
+		mytm.tm_hour = time->hour;
+		mytm.tm_min = time->minute;
+		mytm.tm_sec = time->second;
+		
+		strftime (str, 200, "%F %T", &mytm);

You probably want e_utf8_strftime for portability.  There are also
utility routines to convert an icaltimetype to a struct tm,
icaltimetype_to_tm and icaltimetype_to_tm_with_zone in
e-cal-time-util.h.  I believe "%F %T" should also be marked for
translation.
		
+		needquotes = string_needsquotes (str, config);
+		
+		if (needquotes)
+			line = g_string_append (line, config->quote);	
+		
+		line = g_string_append (line, str);
+		
+		if (needquotes)
+			line = g_string_append (line, config->quote);
+	
+		g_date_free (date);	
+		free (str);
+		
 	}
 
 	line = g_string_append (line, config->delimiter);
+
 	return line;
 }
 
@@ -352,7 +364,7 @@
 
 	result = gnome_vfs_open_uri (&handle, uri, GNOME_VFS_OPEN_READ);
 	if (result == GNOME_VFS_OK)
-		doit = e_error_run(gtk_widget_get_toplevel (GTK_WIDGET (target->selector)),
+		doit = e_error_run(GTK_WINDOW(gtk_widget_get_toplevel (GTK_WIDGET (target->selector))),
 			 E_ERROR_ASK_FILE_EXISTS_OVERWRITE, dest_uri, NULL) == GTK_RESPONSE_OK;
 
 	if (doit) {
@@ -367,14 +379,18 @@
 
 		if (config->header) {
 			line = g_string_new ("");
-			g_string_append_printf (line, _("Uid%sSummary%sDescription List%sCategories List%s"
+				g_string_append_printf (line, "Uid%sSummary%sDescription List%sCategories List%s"
 							"Comment List%sCompleted%sCreated%sContact List%s"
 							"Start%sEnd%sDue%sPercent Done%sPriority%sUrl%s"
-							"Attendees List%sLocation%sModified%s"),
-						config->delimiter, config->delimiter, config->delimiter, config->delimiter, 
-						config->delimiter, config->delimiter, config->delimiter, config->delimiter, 
-						config->delimiter, config->delimiter, config->delimiter, config->delimiter, 
-						config->delimiter, config->delimiter, config->delimiter, config->delimiter, 
+							"Attendees List%sLocation%sModified%s",
+						config->delimiter, config->delimiter, 
+						config->delimiter, config->delimiter, 
+						config->delimiter, config->delimiter, 
+						config->delimiter, config->delimiter, 
+						config->delimiter, config->delimiter, 
+						config->delimiter, config->delimiter, 
+						config->delimiter, config->delimiter, 
+						config->delimiter, config->delimiter, 
 						config->newline);
 
 			gnome_vfs_write (handle, line->str, line->len, NULL);

I think actually its probably better to translate each column header
separately, so that things like _("Due") could potentially be grabbed
from other places for translation.  Perhaps the column headers should
match the table headings more closely where possible.

-JP


-- 
JP Rosevear <jpr novell com>
Novell, Inc.




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