r23110 - gnucash/trunk/src/import-export - Make CSV account import table header translatable. Patch by Aurimas Fišeras.

Cristian Marchi cmarchi at code.gnucash.org
Thu Aug 1 16:06:58 EDT 2013


Author: cmarchi
Date: 2013-08-01 16:06:57 -0400 (Thu, 01 Aug 2013)
New Revision: 23110
Trac: http://svn.gnucash.org/trac/changeset/23110

Modified:
   gnucash/trunk/src/import-export/csv-export/csv-tree-export.c
   gnucash/trunk/src/import-export/csv-import/assistant-csv-account-import.c
Log:
Make CSV account import table header translatable. Patch by Aurimas Fišeras.

Modified: gnucash/trunk/src/import-export/csv-export/csv-tree-export.c
===================================================================
--- gnucash/trunk/src/import-export/csv-export/csv-tree-export.c	2013-08-01 19:10:16 UTC (rev 23109)
+++ gnucash/trunk/src/import-export/csv-export/csv-tree-export.c	2013-08-01 20:06:57 UTC (rev 23110)
@@ -109,11 +109,11 @@
         }
 
         /* Header string */
-        header = g_strconcat ( end_sep, _("type"), mid_sep, _("fullname"), mid_sep,
+        header = g_strconcat ( end_sep, _("type"), mid_sep, _("full_name"), mid_sep,
                                _("name"), mid_sep, _("code"), mid_sep,
                                _("description"), mid_sep, _("color"), mid_sep, _("notes"), mid_sep,
                                _("commoditym"), mid_sep, _("commodityn"), mid_sep,
-                               _("hidden"), mid_sep, _("tax"), mid_sep, _("placeholder"), end_sep, "\n", NULL);
+                               _("hidden"), mid_sep, _("tax"), mid_sep, _("place_holder"), end_sep, "\n", NULL);
         DEBUG("Header String: %s", header);
 
         /* Write header line */

Modified: gnucash/trunk/src/import-export/csv-import/assistant-csv-account-import.c
===================================================================
--- gnucash/trunk/src/import-export/csv-import/assistant-csv-account-import.c	2013-08-01 19:10:16 UTC (rev 23109)
+++ gnucash/trunk/src/import-export/csv-import/assistant-csv-account-import.c	2013-08-01 20:06:57 UTC (rev 23110)
@@ -81,6 +81,37 @@
             "imported data are converted to GnuCash transactions. If this is an "
             "existing file, the dialog will not be shown.\n");
 
+/* Escape '_' in string */
+static gchar *mnemonic_escape (const gchar *source);
+static gchar *mnemonic_escape (const gchar *source)
+{
+    const guchar *p;
+    gchar *dest;
+    gchar *q;
+
+    g_return_val_if_fail (source != NULL, NULL);
+
+    p = (guchar *) source;
+    q = dest = g_malloc (strlen (source) * 2 + 1);
+
+    while (*p)
+      {
+        switch (*p)
+          {
+          case '_':
+            *q++ = '_';
+            *q++ = '_';
+            break;
+          default:
+            *q++ = *p;
+            break;
+          }
+        p++;
+      }
+    *q = 0;
+    return dest;
+}
+
 /*************************************************************************/
 
 /**************************************************
@@ -586,12 +617,12 @@
     gtk_tree_view_set_model( GTK_TREE_VIEW(info->tree_view), GTK_TREE_MODEL(info->store) );
 #define CREATE_COLUMN(description,column_id) \
   renderer = gtk_cell_renderer_text_new (); \
-  column = gtk_tree_view_column_new_with_attributes (description, renderer, "text", column_id, NULL); \
+  column = gtk_tree_view_column_new_with_attributes (mnemonic_escape(_(description)), renderer, "text", column_id, NULL); \
   gtk_tree_view_column_add_attribute(column, renderer, "background", ROW_COLOR); \
   gtk_tree_view_column_set_resizable (column, TRUE); \
   gtk_tree_view_append_column (GTK_TREE_VIEW (info->tree_view), column);
     CREATE_COLUMN ("type", TYPE);
-    CREATE_COLUMN ("full__name", FULL_NAME);
+    CREATE_COLUMN ("full_name", FULL_NAME);
     CREATE_COLUMN ("name", NAME);
     CREATE_COLUMN ("code", CODE);
     CREATE_COLUMN ("description", DESCRIPTION);
@@ -601,7 +632,7 @@
     CREATE_COLUMN ("commodityn", COMMODITYN);
     CREATE_COLUMN ("hidden", HIDDEN);
     CREATE_COLUMN ("tax", TAX);
-    CREATE_COLUMN ("place__holder", PLACE_HOLDER);
+    CREATE_COLUMN ("place_holder", PLACE_HOLDER);
 
     /* Finish Page */
     info->finish_label = GTK_WIDGET(gtk_builder_get_object(builder, "end_page"));



More information about the gnucash-changes mailing list