This test have been modified to add a translatable string that without
context extraction and emits a desired warning, but it can be supressed.

Also, It is based on last patch you posted because It works fine.

Best regards,
Miguel
>From e3c27b08c4e3916d50aebfdb8c73491144791e13 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?= <[email protected]>
Date: Thu, 14 Mar 2013 21:04:35 +0100
Subject: [PATCH 2/3] Test for Glade2 msgctxt support.

---
 gettext-tools/tests/ChangeLog        |    6 ++
 gettext-tools/tests/Makefile.am      |    1 +
 gettext-tools/tests/xgettext-glade-5 |  185 ++++++++++++++++++++++++++++++++++
 3 files changed, 192 insertions(+)
 create mode 100755 gettext-tools/tests/xgettext-glade-5

diff --git a/gettext-tools/tests/ChangeLog b/gettext-tools/tests/ChangeLog
index 65b6b9c..54ad3f4 100644
--- a/gettext-tools/tests/ChangeLog
+++ b/gettext-tools/tests/ChangeLog
@@ -1,3 +1,9 @@
+2013-03-14  Miguel Angel Arruga Vivas  <[email protected]>
+
+	Test msgctxt extraction on glade files.
+	* Makefile.am (TESTS): Add xgettext-glade-5.
+	* xgettext-glade-5: New test for msgctxt Glade2 extraction.
+
 2012-12-25  Daiki Ueno  <[email protected]>
 
 	* gettext-0.18.2 released.
diff --git a/gettext-tools/tests/Makefile.am b/gettext-tools/tests/Makefile.am
index f875913..e66185e 100644
--- a/gettext-tools/tests/Makefile.am
+++ b/gettext-tools/tests/Makefile.am
@@ -80,6 +80,7 @@ TESTS = gettext-1 gettext-2 gettext-3 gettext-4 gettext-5 gettext-6 gettext-7 \
 	xgettext-csharp-7 \
 	xgettext-elisp-1 xgettext-elisp-2 \
 	xgettext-glade-1 xgettext-glade-2 xgettext-glade-3 xgettext-glade-4 \
+	xgettext-glade-5 \
 	xgettext-java-1 xgettext-java-2 xgettext-java-3 xgettext-java-4 \
 	xgettext-java-5 xgettext-java-6 xgettext-java-7 \
 	xgettext-librep-1 xgettext-librep-2 \
diff --git a/gettext-tools/tests/xgettext-glade-5 b/gettext-tools/tests/xgettext-glade-5
new file mode 100755
index 0000000..1cdabec
--- /dev/null
+++ b/gettext-tools/tests/xgettext-glade-5
@@ -0,0 +1,185 @@
+#!/bin/sh
+
+# Test of Glade 2 support for msgctxt.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles empty.glade"
+cat <<EOF > empty.glade
+<?xml version="1.0"?>
+<GTK-Interface/>
+EOF
+
+tmpfiles="$tmpfiles xg-gl-5.pot"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} -o xg-gl-5.pot empty.glade 2>/dev/null
+test $? = 0 || {
+  echo "Skipping test: xgettext was built without Glade support"
+  rm -fr $tmpfiles; exit 77
+}
+
+tmpfiles="$tmpfiles xg-gl-5.glade"
+cat <<EOF > xg-gl-5.glade
+<?xml version="1.0"?>
+<glade-interface>
+  <!-- interface-requires gtk+ 2.8 -->
+  <!-- interface-naming-policy project-wide -->
+  <widget class="GtkWindow" id="window1">
+    <child>
+      <widget class="GtkVBox" id="vbox">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <widget class="GtkButton" id="with_context">
+            <property name="label" translatable="yes" context="yes">Shape|Form</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+          </widget>
+          <packing>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkButton" id="without_context">
+            <property name="label" translatable="yes">Shape|Form</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+          </widget>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+</glade-interface>
+EOF
+
+tmpfiles="$tmpfiles xg-gl-5.tmp xg-gl-5.pot"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} -o xg-gl-5.tmp xg-gl-5.glade
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+# Don't simplify this to "grep ... < xg-gl-5.tmp", otherwise OpenBSD 4.0 grep
+# only outputs "Binary file (standard input) matches".
+cat xg-gl-5.tmp | grep -v 'POT-Creation-Date' > xg-gl-5.pot
+
+tmpfiles="$tmpfiles xg-gl-5.ok"
+cat <<\EOF > xg-gl-5.ok
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <[email protected]>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: xg-gl-5.glade:12
+msgctxt "Shape"
+msgid "Form"
+msgstr ""
+
+#: xg-gl-5.glade:23
+msgid "Shape|Form"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-gl-5.ok xg-gl-5.pot
+result=$?
+
+test $result = 0 || {
+  rm -fr $tmpfiles; exit $result
+}
+
+tmpfiles="$tmpfiles xg-gl-5b.glade"
+cat <<EOF > xg-gl-5b.glade
+<?xml version="1.0"?>
+<glade-interface>
+  <!-- interface-requires gtk+ 2.8 -->
+  <!-- interface-naming-policy project-wide -->
+  <widget class="GtkWindow" id="window1">
+    <child>
+      <widget class="GtkVBox" id="vbox">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <widget class="GtkButton" id="with_context">
+            <property name="label" translatable="yes" context="yes">ShapeForm</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+          </widget>
+          <packing>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkButton" id="without_context">
+            <property name="label" translatable="yes">Shape|Form</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+          </widget>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+</glade-interface>
+EOF
+
+tmpfiles="$tmpfiles xg-gl-5b.tmp xg-gl-5b.pot"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} -o xg-gl-5b.tmp xg-gl-5b.glade
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+# Don't simplify this to "grep ... < xg-gl-5b.tmp", otherwise OpenBSD 4.0 grep
+# only outputs "Binary file (standard input) matches".
+cat xg-gl-5b.tmp | grep -v 'POT-Creation-Date' > xg-gl-5b.pot
+
+tmpfiles="$tmpfiles xg-gl-5b.ok"
+cat <<\EOF > xg-gl-5b.ok
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <[email protected]>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: xg-gl-5b.glade:23
+msgid "Shape|Form"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-gl-5b.ok xg-gl-5b.pot
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
-- 
1.7.10.4

Reply via email to