Re: [evolution-patches] Patch for translation-issues in save-calendar plugin (#73099)
- From: Philip Van Hoof <spamfrommailing freax org>
- To: JP Rosevear <jpr novell com>
- Cc: Evolution Patches <evolution-patches lists ximian com>
- Subject: Re: [evolution-patches] Patch for translation-issues in save-calendar plugin (#73099)
- Date: Tue, 01 Mar 2005 21:39:19 +0100
On Tue, 2005-03-01 at 15:15 -0500, JP Rosevear wrote:
>
> This makes it a little tricky to comment on inline, however:
>
> 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.
Done, checkout the new patch (attached).
> 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.
Rewritten the header-stuff. Now each column is separately translatable.
This new patch gives more control to the translators. They can both
change the header and the date-formatting.
The user can't control this (unless, of course, the user sets it's
locale before starting evo).
--
Philip Van Hoof, Software Developer @ Cronos
home: me at freax dot org
gnome: pvanhoof at gnome dot org
work: philip dot vanhoof at cronos dot be
junk: philip dot vanhoof at gmail dot com
http://www.freax.be, http://www.freax.eu.org
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 1 Mar 2005 20:36:51 -0000
@@ -34,6 +34,8 @@
#include <gtk/gtkstock.h>
#include <gtk/gtk.h>
#include <libedataserver/e-source.h>
+#include <libecal/e-cal-time-util.h>
+#include <libedataserver/e-util.h>
#include <libedataserverui/e-source-selector.h>
#include <libecal/e-cal.h>
#include <calendar/gui/e-cal-popup.h>
@@ -155,25 +157,34 @@
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 = icaltimetype_to_tm (time);
+ char *str = (char*) malloc (sizeof (char) * 200);
+
+ /*
+ * Translator: the %F %T is the thirth argument for a strftime function.
+ * It lets you define the formatting of the date in the csv-file.
+ * */
+ e_utf8_strftime (str, 200, _("%F %T"), &mytm);
+
+ 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);
+
+ free (str);
+
}
line = g_string_append (line, config->delimiter);
+
return line;
}
@@ -352,7 +363,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,15 +378,42 @@
if (config->header) {
line = g_string_new ("");
- 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,
- config->newline);
+
+ line = g_string_append (line, _("Uid"));
+ line = g_string_append (line, config->delimiter);
+ line = g_string_append (line, _("Summary"));
+ line = g_string_append (line, config->delimiter);
+ line = g_string_append (line, _("Description List"));
+ line = g_string_append (line, config->delimiter);
+ line = g_string_append (line, _("Categories List"));
+ line = g_string_append (line, config->delimiter);
+ line = g_string_append (line, _("Comment List"));
+ line = g_string_append (line, config->delimiter);
+ line = g_string_append (line, _("Completed"));
+ line = g_string_append (line, config->delimiter);
+ line = g_string_append (line, _("Created"));
+ line = g_string_append (line, config->delimiter);
+ line = g_string_append (line, _("Contact List"));
+ line = g_string_append (line, config->delimiter);
+ line = g_string_append (line, _("Start"));
+ line = g_string_append (line, config->delimiter);
+ line = g_string_append (line, _("End"));
+ line = g_string_append (line, config->delimiter);
+ line = g_string_append (line, _("Due"));
+ line = g_string_append (line, config->delimiter);
+ line = g_string_append (line, _("percent Done"));
+ line = g_string_append (line, config->delimiter);
+ line = g_string_append (line, _("Priority"));
+ line = g_string_append (line, config->delimiter);
+ line = g_string_append (line, _("Url"));
+ line = g_string_append (line, config->delimiter);
+ line = g_string_append (line, _("Attendees List"));
+ line = g_string_append (line, config->delimiter);
+ line = g_string_append (line, _("Location"));
+ line = g_string_append (line, config->delimiter);
+ line = g_string_append (line, _("Modified"));
+
+ line = g_string_append (line, config->newline);
gnome_vfs_write (handle, line->str, line->len, NULL);
g_string_free (line, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]