Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-glade-5
1 #!/bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test of Glade 2 support for msgctxt.
5
6 cat <<EOF > xg-gl-5-empty.glade
7 <?xml version="1.0"?>
8 <GTK-Interface/>
9 EOF
10
11 : ${XGETTEXT=xgettext}
12 ${XGETTEXT} -o xg-gl-5.pot xg-gl-5-empty.glade 2>/dev/null
13 test $? = 0 || {
14   echo "Skipping test: xgettext was built without Glade support"
15   exit 77
16 }
17
18 cat <<EOF > xg-gl-5.glade
19 <?xml version="1.0"?>
20 <glade-interface>
21   <!-- interface-requires gtk+ 2.8 -->
22   <!-- interface-naming-policy project-wide -->
23   <widget class="GtkWindow" id="window1">
24     <child>
25       <widget class="GtkVBox" id="vbox">
26         <property name="visible">True</property>
27         <property name="orientation">vertical</property>
28         <child>
29           <widget class="GtkButton" id="with_context">
30             <property name="label" translatable="yes" context="yes">Shape|Form</property>
31             <property name="visible">True</property>
32             <property name="can_focus">True</property>
33             <property name="receives_default">True</property>
34           </widget>
35           <packing>
36             <property name="position">0</property>
37           </packing>
38         </child>
39         <child>
40           <widget class="GtkButton" id="without_context">
41             <property name="label" translatable="yes">Shape|Form</property>
42             <property name="visible">True</property>
43             <property name="can_focus">True</property>
44             <property name="receives_default">True</property>
45           </widget>
46           <packing>
47             <property name="position">1</property>
48           </packing>
49         </child>
50       </widget>
51     </child>
52   </widget>
53 </glade-interface>
54 EOF
55
56 : ${XGETTEXT=xgettext}
57 ${XGETTEXT} -o xg-gl-5.tmp xg-gl-5.glade || exit 1
58 # Don't simplify this to "grep ... < xg-gl-5.tmp", otherwise OpenBSD 4.0 grep
59 # only outputs "Binary file (standard input) matches".
60 cat xg-gl-5.tmp | grep -v 'POT-Creation-Date' > xg-gl-5.pot
61
62 cat <<\EOF > xg-gl-5.ok
63 # SOME DESCRIPTIVE TITLE.
64 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
65 # This file is distributed under the same license as the PACKAGE package.
66 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
67 #
68 #, fuzzy
69 msgid ""
70 msgstr ""
71 "Project-Id-Version: PACKAGE VERSION\n"
72 "Report-Msgid-Bugs-To: \n"
73 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
74 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
75 "Language-Team: LANGUAGE <LL@li.org>\n"
76 "Language: \n"
77 "MIME-Version: 1.0\n"
78 "Content-Type: text/plain; charset=CHARSET\n"
79 "Content-Transfer-Encoding: 8bit\n"
80
81 #: xg-gl-5.glade:12
82 msgctxt "Shape"
83 msgid "Form"
84 msgstr ""
85
86 #: xg-gl-5.glade:23
87 msgid "Shape|Form"
88 msgstr ""
89 EOF
90
91 : ${DIFF=diff}
92 ${DIFF} xg-gl-5.ok xg-gl-5.pot
93 result=$?
94
95 test $result = 0 || {
96   exit $result
97 }
98
99 # Check with --extract-all option
100 rm xg-gl-5.tmp
101 ${XGETTEXT} -a -o xg-gl-5.tmp xg-gl-5.glade || exit 1
102 # Don't simplify this to "grep ... < xg-gl-5.tmp", otherwise OpenBSD 4.0 grep
103 # only outputs "Binary file (standard input) matches".
104 cat xg-gl-5.tmp | grep -v 'POT-Creation-Date' > xg-gl-5.pot
105
106 ${DIFF} xg-gl-5.ok xg-gl-5.pot
107 result=$?
108
109 test $result = 0 || {
110   exit $result
111 }
112
113 cat <<EOF > xg-gl-5b.glade
114 <?xml version="1.0"?>
115 <glade-interface>
116   <!-- interface-requires gtk+ 2.8 -->
117   <!-- interface-naming-policy project-wide -->
118   <widget class="GtkWindow" id="window1">
119     <child>
120       <widget class="GtkVBox" id="vbox">
121         <property name="visible">True</property>
122         <property name="orientation">vertical</property>
123         <child>
124           <widget class="GtkButton" id="with_context">
125             <property name="label" translatable="yes" context="yes">ShapeForm</property>
126             <property name="visible">True</property>
127             <property name="can_focus">True</property>
128             <property name="receives_default">True</property>
129           </widget>
130           <packing>
131             <property name="position">0</property>
132           </packing>
133         </child>
134         <child>
135           <widget class="GtkButton" id="without_context">
136             <property name="label" translatable="yes">Shape|Form</property>
137             <property name="visible">True</property>
138             <property name="can_focus">True</property>
139             <property name="receives_default">True</property>
140           </widget>
141           <packing>
142             <property name="position">1</property>
143           </packing>
144         </child>
145       </widget>
146     </child>
147   </widget>
148 </glade-interface>
149 EOF
150
151 : ${XGETTEXT=xgettext}
152 ${XGETTEXT} -o xg-gl-5b.tmp xg-gl-5b.glade 2>/dev/null || exit 1
153 # Don't simplify this to "grep ... < xg-gl-5b.tmp", otherwise OpenBSD 4.0 grep
154 # only outputs "Binary file (standard input) matches".
155 cat xg-gl-5b.tmp | grep -v 'POT-Creation-Date' > xg-gl-5b.pot
156
157 cat <<\EOF > xg-gl-5b.ok
158 # SOME DESCRIPTIVE TITLE.
159 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
160 # This file is distributed under the same license as the PACKAGE package.
161 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
162 #
163 #, fuzzy
164 msgid ""
165 msgstr ""
166 "Project-Id-Version: PACKAGE VERSION\n"
167 "Report-Msgid-Bugs-To: \n"
168 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
169 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
170 "Language-Team: LANGUAGE <LL@li.org>\n"
171 "Language: \n"
172 "MIME-Version: 1.0\n"
173 "Content-Type: text/plain; charset=CHARSET\n"
174 "Content-Transfer-Encoding: 8bit\n"
175
176 #: xg-gl-5b.glade:23
177 msgid "Shape|Form"
178 msgstr ""
179 EOF
180
181 : ${DIFF=diff}
182 ${DIFF} xg-gl-5b.ok xg-gl-5b.pot
183 result=$?
184
185 exit $result