Test for Glade2 msgctxt support.

This commit is contained in:
Miguel Ángel Arruga Vivas 2013-03-14 21:04:35 +01:00
parent 852df7d303
commit bd05992625
3 changed files with 192 additions and 0 deletions

View 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.

View 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 \

View File

@ -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