Hi,

This patch is another previous issue for Glade2 fixes before GtkBuilder
actual implementation.

Currently, when --extract-all option is passed, the file is treated like
a Glade1 file: it does not extract msgctxt neither comments neither
atkaction's description. This solves that (unreported) issue. Also It is
used by future GtkBuilder --extract-all support patch.

Happy Hacking! :)
Miguel
>From c18bdf9906aa95fd7d59105b4d9925be4c4640fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?= <[email protected]>
Date: Wed, 20 Mar 2013 20:41:13 +0100
Subject: [PATCH 1/4] xgettext: Fix --extract-all option in Glade2 files.

"context" and "comments" attributes from Glade2 files are stored in
the message list when --extract-all option is passed.
---
 gettext-tools/src/ChangeLog |    6 ++++++
 gettext-tools/src/x-glade.c |    8 +++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog
index 66bd3c4..d5cab09 100644
--- a/gettext-tools/src/ChangeLog
+++ b/gettext-tools/src/ChangeLog
@@ -1,3 +1,9 @@
+2013-03-20  Miguel Ángel Arruga Vivas  <[email protected]>
+
+	Fix --extract-all option support in Glade2 files.
+	* x-glade.c (start_element_handler): Add condition to extract
+	always context and comments attributes in Glade2 tags.
+
 2013-03-15  Miguel Ángel Arruga Vivas  <[email protected]>
             Daiki Ueno  <[email protected]>
 
diff --git a/gettext-tools/src/x-glade.c b/gettext-tools/src/x-glade.c
index 85ed21c..73aa9b2 100644
--- a/gettext-tools/src/x-glade.c
+++ b/gettext-tools/src/x-glade.c
@@ -441,8 +441,7 @@ start_element_handler (void *userData, const char *name,
      The translator comment is found in the attribute comments="...".
      See <http://live.gnome.org/TranslationProject/DevGuidelines/Use comments>.
    */
-  if (!p->extract_string
-      && (strcmp (name, "property") == 0 || strcmp (name, "atkproperty") == 0))
+  if (strcmp (name, "property") == 0 || strcmp (name, "atkproperty") == 0)
     {
       bool has_translatable = false;
       bool has_context = false;
@@ -458,15 +457,14 @@ start_element_handler (void *userData, const char *name,
             has_context = (strcmp (attp[1], "yes") == 0);
           attp += 2;
         }
-      p->extract_string = has_translatable;
+      p->extract_string = has_translatable || extract_all;
       p->extract_context = has_context;
       p->extracted_comment =
         (has_translatable && extracted_comment != NULL
          ? xstrdup (extracted_comment)
          : NULL);
     }
-  if (!p->extract_string
-      && strcmp (name, "atkaction") == 0)
+  if (strcmp (name, "atkaction") == 0)
     {
       const char **attp = attributes;
       while (*attp != NULL)
-- 
1.7.10.4

Reply via email to