[evolution-data-server] Bug #538793 - Translation issues under camel/providers/local



commit c9e5ca748b3196d7d171ce78f7cf530c7d2bacc8
Author: Milan Crha <mcrha redhat com>
Date:   Fri Apr 2 18:14:54 2010 +0200

    Bug #538793 - Translation issues under camel/providers/local

 camel/providers/local/camel-local-folder.c   |   24 +++++++++++++++++++++---
 camel/providers/local/camel-local-folder.h   |    2 ++
 camel/providers/local/camel-maildir-folder.c |   15 +++++----------
 camel/providers/local/camel-mbox-folder.c    |   19 +++++++------------
 camel/providers/local/camel-mh-folder.c      |   15 ++++++---------
 5 files changed, 41 insertions(+), 34 deletions(-)
---
diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c
index 5b2890c..5736aac 100644
--- a/camel/providers/local/camel-local-folder.c
+++ b/camel/providers/local/camel-local-folder.c
@@ -391,18 +391,27 @@ local_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
 				sprintf (path, "%s/%s", tmp, folder->full_name);
 
 				if ((tmp = getenv("HOME")) && strncmp(tmp, path, strlen(tmp)) == 0)
-					/* $HOME relative path + protocol string */
+					/* Translators: This is used for a folder description, for folders being under $HOME.
+					   The first %s is replaced with a relative path under $HOME,
+					   the second %s is replaced with a protocol name, like mbox/maldir/... */
 					folder->description = g_strdup_printf(_("~%s (%s)"), path+strlen(tmp),
 									      ((CamelService *)folder->parent_store)->url->protocol);
 				else if ((tmp = "/var/spool/mail") && strncmp(tmp, path, strlen(tmp)) == 0)
-					/* /var/spool/mail relative path + protocol */
+					/* Translators: This is used for a folder description, for folders being under /var/spool/mail.
+					   The first %s is replaced with a relative path under /var/spool/mail,
+					   the second %s is replaced with a protocol name, like mbox/maldir/... */
 					folder->description = g_strdup_printf(_("mailbox: %s (%s)"), path+strlen(tmp),
 									      ((CamelService *)folder->parent_store)->url->protocol);
 				else if ((tmp = "/var/mail") && strncmp(tmp, path, strlen(tmp)) == 0)
+					/* Translators: This is used for a folder description, for folders being under /var/mail.
+					   The first %s is replaced with a relative path under /var/mail,
+					   the second %s is replaced with a protocol name, like mbox/maldir/... */
 					folder->description = g_strdup_printf(_("mailbox: %s (%s)"), path+strlen(tmp),
 									      ((CamelService *)folder->parent_store)->url->protocol);
 				else
-					/* a full path + protocol */
+					/* Translators: This is used for a folder description.
+					   The first %s is replaced with a folder's full path,
+					   the second %s is replaced with a protocol name, like mbox/maldir/... */
 					folder->description = g_strdup_printf(_("%s (%s)"), path,
 									      ((CamelService *)folder->parent_store)->url->protocol);
 			}
@@ -652,3 +661,12 @@ local_search_free(CamelFolder *folder, GPtrArray * result)
 
 	CAMEL_LOCAL_FOLDER_UNLOCK(folder, search_lock);
 }
+
+void
+set_cannot_get_message_ex (CamelException *ex, ExceptionId exId, const gchar *msgID, const gchar *folder_path, const gchar *detailErr)
+{
+	/* Translators: The first %s is replaced with a message ID,
+	   the second %s is replaced with the folder path,
+	   the third %s is replaced with a detailed error string */
+	camel_exception_setv (ex, exId, _("Cannot get message %s from folder %s\n%s"), msgID, folder_path, detailErr);
+}
diff --git a/camel/providers/local/camel-local-folder.h b/camel/providers/local/camel-local-folder.h
index f8cdbb7..d51a83f 100644
--- a/camel/providers/local/camel-local-folder.h
+++ b/camel/providers/local/camel-local-folder.h
@@ -98,6 +98,8 @@ CamelType camel_local_folder_get_type(void);
 gint camel_local_folder_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex);
 gint camel_local_folder_unlock(CamelLocalFolder *lf);
 
+void set_cannot_get_message_ex (CamelException *ex, ExceptionId exId, const gchar *msgID, const gchar *folder_path, const gchar *detailErr);
+
 G_END_DECLS
 
 #endif /* CAMEL_LOCAL_FOLDER_H */
diff --git a/camel/providers/local/camel-maildir-folder.c b/camel/providers/local/camel-maildir-folder.c
index a5e02be..d07baa9 100644
--- a/camel/providers/local/camel-maildir-folder.c
+++ b/camel/providers/local/camel-maildir-folder.c
@@ -259,8 +259,7 @@ maildir_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex)
 
 	/* get the message summary info */
 	if ((info = camel_folder_summary_uid(folder->summary, uid)) == NULL) {
-		camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
-				     _("Cannot get message: %s from folder %s\n  %s"),
+		set_cannot_get_message_ex (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
 				     uid, lf->folder_path, _("No such message"));
 		return NULL;
 	}
@@ -288,8 +287,7 @@ maildir_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex
 
 	/* get the message summary info */
 	if ((info = camel_folder_summary_uid(folder->summary, uid)) == NULL) {
-		camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
-				     _("Cannot get message: %s from folder %s\n  %s"),
+		set_cannot_get_message_ex (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
 				     uid, lf->folder_path, _("No such message"));
 		goto fail;
 	}
@@ -302,16 +300,14 @@ maildir_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex
 	camel_message_info_free(info);
 
 	if ((message_stream = camel_stream_fs_new_with_name(name, O_RDONLY, 0)) == NULL) {
-		camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
-				     _("Cannot get message: %s from folder %s\n  %s"),
+		set_cannot_get_message_ex (ex, CAMEL_EXCEPTION_SYSTEM,
 				     uid, lf->folder_path, g_strerror(errno));
 		goto fail;
 	}
 
 	message = camel_mime_message_new();
 	if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)message, message_stream) == -1) {
-		camel_exception_setv(ex, (errno==EINTR)?CAMEL_EXCEPTION_USER_CANCEL:CAMEL_EXCEPTION_SYSTEM,
-				     _("Cannot get message: %s from folder %s\n  %s"),
+		set_cannot_get_message_ex (ex, (errno==EINTR)?CAMEL_EXCEPTION_USER_CANCEL:CAMEL_EXCEPTION_SYSTEM,
 				     uid, lf->folder_path, _("Invalid message contents"));
 		camel_object_unref((CamelObject *)message);
 		message = NULL;
@@ -396,8 +392,7 @@ maildir_transfer_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder
 			CamelMessageInfo *info;
 
 			if ((info = camel_folder_summary_uid (source->summary, uid)) == NULL) {
-				camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
-						     _("Cannot get message: %s from folder %s\n  %s"),
+				set_cannot_get_message_ex (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
 						     uid, lf->folder_path, _("No such message"));
 				return;
 			}
diff --git a/camel/providers/local/camel-mbox-folder.c b/camel/providers/local/camel-mbox-folder.c
index c6f28cb..8429368 100644
--- a/camel/providers/local/camel-mbox-folder.c
+++ b/camel/providers/local/camel-mbox-folder.c
@@ -358,8 +358,7 @@ mbox_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex)
 	info = (CamelMboxMessageInfo *) camel_folder_summary_uid(folder->summary, uid);
 
 	if (info == NULL) {
-		camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
-				     _("Cannot get message: %s from folder %s\n  %s"),
+		set_cannot_get_message_ex (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
 				     uid, lf->folder_path, _("No such message"));
 		goto fail;
 	}
@@ -409,8 +408,7 @@ retry:
 	info = (CamelMboxMessageInfo *) camel_folder_summary_uid(folder->summary, uid);
 
 	if (info == NULL) {
-		camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
-				     _("Cannot get message: %s from folder %s\n  %s"),
+		set_cannot_get_message_ex (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
 				     uid, lf->folder_path, _("No such message"));
 		goto fail;
 	}
@@ -430,8 +428,7 @@ retry:
 
 	fd = g_open(lf->folder_path, O_LARGEFILE | O_RDONLY | O_BINARY, 0);
 	if (fd == -1) {
-		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-				      _("Cannot get message: %s from folder %s\n  %s"),
+		set_cannot_get_message_ex (ex, CAMEL_EXCEPTION_SYSTEM,
 				      uid, lf->folder_path, g_strerror (errno));
 		goto fail;
 	}
@@ -461,17 +458,15 @@ retry:
 				goto retry;
 		}
 
-		camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID,
-				     _("Cannot get message: %s from folder %s\n  %s"), uid, lf->folder_path,
-				     _("The folder appears to be irrecoverably corrupted."));
+		set_cannot_get_message_ex (ex, CAMEL_EXCEPTION_FOLDER_INVALID,
+				     uid, lf->folder_path, _("The folder appears to be irrecoverably corrupted."));
 		goto fail;
 	}
 
 	message = camel_mime_message_new();
 	if (camel_mime_part_construct_from_parser((CamelMimePart *)message, parser) == -1) {
-		camel_exception_setv(ex, errno==EINTR?CAMEL_EXCEPTION_USER_CANCEL:CAMEL_EXCEPTION_SYSTEM,
-				     _("Cannot get message: %s from folder %s\n  %s"), uid, lf->folder_path,
-				     _("Message construction failed."));
+		set_cannot_get_message_ex (ex, errno==EINTR?CAMEL_EXCEPTION_USER_CANCEL:CAMEL_EXCEPTION_SYSTEM,
+				     uid, lf->folder_path, _("Message construction failed."));
 		camel_object_unref((CamelObject *)message);
 		message = NULL;
 		goto fail;
diff --git a/camel/providers/local/camel-mh-folder.c b/camel/providers/local/camel-mh-folder.c
index d4f2779..e93e673 100644
--- a/camel/providers/local/camel-mh-folder.c
+++ b/camel/providers/local/camel-mh-folder.c
@@ -221,9 +221,8 @@ static CamelMimeMessage *mh_get_message(CamelFolder * folder, const gchar * uid,
 
 	/* get the message summary info */
 	if ((info = camel_folder_summary_uid(folder->summary, uid)) == NULL) {
-		camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
-				     _("Cannot get message: %s from folder %s\n  %s"), uid, lf->folder_path,
-				     _("No such message"));
+		set_cannot_get_message_ex (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+				     uid, lf->folder_path, _("No such message"));
 		goto fail;
 	}
 
@@ -232,17 +231,15 @@ static CamelMimeMessage *mh_get_message(CamelFolder * folder, const gchar * uid,
 
 	name = g_strdup_printf("%s/%s", lf->folder_path, uid);
 	if ((message_stream = camel_stream_fs_new_with_name(name, O_RDONLY, 0)) == NULL) {
-		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-				      _("Cannot get message: %s from folder %s\n  %s"), name, lf->folder_path,
-				      g_strerror (errno));
+		set_cannot_get_message_ex (ex, CAMEL_EXCEPTION_SYSTEM,
+				      name, lf->folder_path, g_strerror (errno));
 		goto fail;
 	}
 
 	message = camel_mime_message_new();
 	if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)message, message_stream) == -1) {
-		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-				      _("Cannot get message: %s from folder %s\n  %s"), name, lf->folder_path,
-				      _("Message construction failed."));
+		set_cannot_get_message_ex (ex, CAMEL_EXCEPTION_SYSTEM,
+				      name, lf->folder_path, _("Message construction failed."));
 		camel_object_unref((CamelObject *)message);
 		message = NULL;
 



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