[evolution-kolab] KolabMailSideCache: rework of the previous gettext fix



commit e9302f7e3db763fe88b1725bba5139bf5101bd8f
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Tue May 29 17:29:58 2012 +0200

    KolabMailSideCache: rework of the previous gettext fix
    
    * strdup() all strings returned by ngettext()
      to properly insert values for placeholders
    * added better hints for translators to clarify
      that there are three separate but consecutive
      sentences, each translatable, which comprise
      one message

 src/libekolab/kolab-mail-side-cache.c |   52 +++++++++++++++++++++------------
 1 files changed, 33 insertions(+), 19 deletions(-)
---
diff --git a/src/libekolab/kolab-mail-side-cache.c b/src/libekolab/kolab-mail-side-cache.c
index 445535d..c31daf8 100644
--- a/src/libekolab/kolab-mail-side-cache.c
+++ b/src/libekolab/kolab-mail-side-cache.c
@@ -305,35 +305,49 @@ kolab_mail_side_cache_sql_query_object (KolabUtilSqliteDb *kdb,
 		/* check number of expected payload bytes */
 		mpart->length = (guint) sqlite3_column_int (sql_stmt,
 		                                            KOLAB_CONV_MAIL_SQLCOL_FIELD_LENGTH);
-		nbytes = (guint) sqlite3_column_bytes(sql_stmt,
-		                                      KOLAB_CONV_MAIL_SQLCOL_FIELD_DATA);
+		nbytes = (guint) sqlite3_column_bytes (sql_stmt,
+		                                       KOLAB_CONV_MAIL_SQLCOL_FIELD_DATA);
 		if (mpart->length != nbytes) {
 			gchar *errmsg_0 = NULL;
-			const gchar *errmsg_1 = NULL;
-			const gchar *errmsg_2 = NULL;
-			/* Hint to translators:
-			 *
-			 * These error messages truly comprise one sentence
-			 * with two plural forms. Since ngettext() cannot handle
-			 * such, I've decided to break it up into three (though
-			 * this can also be problematic when translating).
-			 *
-			 * Both bytecounts are never expected to be one or less.
+			gchar *errmsg_1 = NULL;
+			gchar *errmsg_2 = NULL;
+
+			/* Translators: This is the first sentence of a three-sentence message
+			 * of the form "Internal inconsistency detected: Invalid cache object, UID [uid],
+			 * Folder [foldername]. Expected payload size is [bytes] bytes. Actual payload
+			 * size is [bytes] bytes."
 			 */
 			errmsg_0 = g_strdup_printf (_("Internal inconsistency detected: Invalid cache object, UID '%s', Folder '%s'."),
 			                            uid, foldername);
-			errmsg_1 = ngettext ("Expected payload size is %i byte.",
-			                     "Expected payload size is %i bytes.",
-			                     nbytes);
-			errmsg_2 = ngettext ("Actual payload size is %i byte.",
-			                     "Actual payload size is %i bytes.",
-			                     mpart->length);
+
+			/* Translators: This is the second sentence of a three-sentence message
+			 * of the form "Internal inconsistency detected: Invalid cache object, UID [uid],
+			 * Folder [foldername]. Expected payload size is [bytes] bytes. Actual payload
+			 * size is [bytes] bytes."
+			 */
+			errmsg_1 = g_strdup_printf (ngettext ("Expected payload size is %i byte.",
+			                                      "Expected payload size is %i bytes.",
+			                                      mpart->length),
+			                            mpart->length);
+
+			/* Translators: This is the third sentence of a three-sentence message
+			 * of the form "Internal inconsistency detected: Invalid cache object, UID [uid],
+			 * Folder [foldername]. Expected payload size is [bytes] bytes. Actual payload
+			 * size is [bytes] bytes."
+			 */
+			errmsg_2 = g_strdup_printf (ngettext ("Actual payload size is %i byte.",
+			                                      "Actual payload size is %i bytes.",
+			                                      nbytes),
+			                            nbytes);
+
 			g_set_error (&tmp_err,
 			             KOLAB_UTIL_ERROR,
 			             KOLAB_UTIL_ERROR_SQLITE_DB,
-			             "%s %s %s",
+			             "%s %s %s", /* sentence concatenation here */
 			             errmsg_0, errmsg_1, errmsg_2);
 			g_free (errmsg_0);
+			g_free (errmsg_1);
+			g_free (errmsg_2);
 			break;
 		}
 		mpart->name = g_strdup ((gchar *) sqlite3_column_text (sql_stmt,



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