Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-glade-6
1 #!/bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test of GtkBuilder support.
5 # Checks that the extracted pot contains the right translatable
6 # content, comments and context.
7
8 cat <<EOF > xg-gl-6-empty.glade
9 <?xml version="1.0"?>
10 <GTK-Interface/>
11 EOF
12
13 : ${XGETTEXT=xgettext}
14 ${XGETTEXT} -o xg-gl-6.pot xg-gl-6-empty.glade 2>/dev/null
15 test $? = 0 || {
16   echo "Skipping test: xgettext was built without Glade support"
17   exit 77
18 }
19
20 cat <<EOF > xg-gl-6.ui
21 <?xml version="1.0" encoding="UTF-8"?>
22 <interface>
23   <!-- interface-requires gtk+ 3.0 -->
24   <object class="GtkWindow" id="window">
25     <property name="can_focus">False</property>
26     <property name="title" translatable="yes" context="This is the context for this text" comments="This is a comment for empty window">This is an empty window</property>
27     <child>
28       <placeholder/>
29     </child>
30   </object>
31 </interface>
32 EOF
33
34 : ${XGETTEXT=xgettext}
35 ${XGETTEXT} -o - xg-gl-6.ui | grep -v 'POT-Creation-Date' > xg-gl-6.pot || exit 1
36
37 cat <<EOF > xg-gl-6.ok
38 # SOME DESCRIPTIVE TITLE.
39 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
40 # This file is distributed under the same license as the PACKAGE package.
41 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
42 #
43 #, fuzzy
44 msgid ""
45 msgstr ""
46 "Project-Id-Version: PACKAGE VERSION\n"
47 "Report-Msgid-Bugs-To: \n"
48 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
49 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
50 "Language-Team: LANGUAGE <LL@li.org>\n"
51 "Language: \n"
52 "MIME-Version: 1.0\n"
53 "Content-Type: text/plain; charset=CHARSET\n"
54 "Content-Transfer-Encoding: 8bit\n"
55
56 #. This is a comment for empty window
57 #: xg-gl-6.ui:6
58 msgctxt "This is the context for this text"
59 msgid "This is an empty window"
60 msgstr ""
61 EOF
62
63 : ${DIFF=diff}
64 ${DIFF} xg-gl-6.ok xg-gl-6.pot
65 result=$?
66
67 test $result = 0 || {
68   exit $result
69 }
70
71 # Check with --extract-all option.
72 ${XGETTEXT} -a -o - xg-gl-6.ui | grep -v 'POT-Creation-Date' > xg-gl-6.pot || exit 1
73
74 # Must be ignored.
75 ${DIFF} xg-gl-6.ok xg-gl-6.pot
76 result=$?
77
78 exit $result