]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Test for Glade2 msgctxt support.
authorMiguel Ángel Arruga Vivas <rosen644835@gmail.com>
Thu, 14 Mar 2013 20:04:35 +0000 (21:04 +0100)
committerMiguel Ángel Arruga Vivas <rosen644835@gmail.com>
Fri, 15 Mar 2013 07:37:44 +0000 (08:37 +0100)
gettext-tools/tests/ChangeLog
gettext-tools/tests/Makefile.am
gettext-tools/tests/xgettext-glade-5 [new file with mode: 0755]

index 65b6b9c55f325428b6561945488f8aca97253b07..54ad3f41217b077f3b38da634da7fb01f79703e8 100644 (file)
@@ -1,3 +1,9 @@
+2013-03-14  Miguel Angel Arruga Vivas  <rosen644835@gmail.com>
+
+       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  <ueno@gnu.org>
 
        * gettext-0.18.2 released.
index f8759135e72e78f55713412238fc19c4f02a6309..e66185e8c8e14ee04c3ce5360c89049f6440abe4 100644 (file)
@@ -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 (executable)
index 0000000..ad4ea05
--- /dev/null
@@ -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 <LL@li.org>\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 2>/dev/null
+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 <LL@li.org>\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