Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-glade-7
1 #!/bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test of GtkBuilder support.
5 # Checks the extraction of a medium size GtkBuilder file, with
6 # comments, context and translatable and not translatable content.
7
8 cat <<EOF > xg-gl-7-empty.glade
9 <?xml version="1.0"?>
10 <GTK-Interface/>
11 EOF
12
13 : ${XGETTEXT=xgettext}
14 ${XGETTEXT} -o xg-gl-7.pot xg-gl-7-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-7.ui
21 <?xml version="1.0" encoding="UTF-8"?>
22 <interface>
23   <!-- interface-requires gtk+ 3.0 -->
24   <object class="GtkImage" id="image1">
25     <property name="visible">True</property>
26     <property name="can_focus">False</property>
27     <property name="stock">gtk-about</property>
28   </object>
29   <object class="GtkImage" id="image2">
30     <property name="visible">True</property>
31     <property name="can_focus">False</property>
32     <property name="stock">gtk-help</property>
33   </object>
34   <object class="GtkImage" id="image3">
35     <property name="visible">True</property>
36     <property name="can_focus">False</property>
37     <property name="stock">gtk-connect</property>
38   </object>
39   <object class="GtkListStore" id="liststore">
40     <columns>
41       <!-- column-name first column -->
42       <column type="gchararray"/>
43       <!-- column-name second column -->
44       <column type="gchararray"/>
45       <!-- column-name not extracted column -->
46       <column type="guint64"/>
47     </columns>
48     <data>
49       <row>
50         <col id="0" translatable="yes" context="First row">Hi</col>
51         <col id="1" translatable="yes" comments="A comment.">Comment</col>
52         <col id="2">999</col>
53       </row>
54       <row>
55         <col id="0" translatable="yes" context="First row">Hello</col>
56         <col id="1" translatable="yes" comments="This is no translatable.">Translatable comment.</col>
57         <col id="2">88</col>
58       </row>
59       <row>
60         <col id="0" translatable="no" context="First row" comments="Yeah">Oi</col>
61         <col id="1" translatable="yes" context="This is not translatable">Please...</col>
62         <col id="2">86855555</col>
63       </row>
64       <row>
65         <col id="0" translatable="yes" context="First row">Hi</col>
66         <col id="1" translatable="yes" comments="A multiline&#10;comment.">Comment</col>
67         <col id="2">999</col>
68       </row>
69     </data>
70   </object>
71   <object class="GtkWindow" id="window">
72     <property name="can_focus">False</property>
73     <child>
74       <object class="GtkBox" id="box">
75         <property name="visible">True</property>
76         <property name="can_focus">False</property>
77         <property name="orientation">vertical</property>
78         <child>
79           <object class="GtkMenuBar" id="menubar">
80             <property name="visible">True</property>
81             <property name="can_focus">False</property>
82             <child>
83               <object class="GtkMenuItem" id="menuitem1">
84                 <property name="use_action_appearance">False</property>
85                 <property name="visible">True</property>
86                 <property name="can_focus">False</property>
87                 <property name="label" translatable="yes" context="Menu" comments="This thing is the menu label">One thing</property>
88                 <property name="use_underline">True</property>
89                 <child type="submenu">
90                   <object class="GtkMenu" id="menu1">
91                     <property name="visible">True</property>
92                     <property name="can_focus">False</property>
93                     <child>
94                       <object class="GtkImageMenuItem" id="imagemenuitem1">
95                         <property name="label" translatable="yes" context="One thing" comments="This thing is the label in the inner menu.">One thing</property>
96                         <property name="use_action_appearance">False</property>
97                         <property name="visible">True</property>
98                         <property name="can_focus">False</property>
99                         <property name="image">image1</property>
100                         <property name="use_stock">False</property>
101                       </object>
102                     </child>
103                   </object>
104                 </child>
105               </object>
106             </child>
107             <child>
108               <object class="GtkMenuItem" id="menuitem2">
109                 <property name="use_action_appearance">False</property>
110                 <property name="visible">True</property>
111                 <property name="can_focus">False</property>
112                 <property name="label" translatable="yes" context="Menu" comments="This is easy.">H_elp</property>
113                 <property name="use_underline">True</property>
114                 <child type="submenu">
115                   <object class="GtkMenu" id="menu2">
116                     <property name="visible">True</property>
117                     <property name="can_focus">False</property>
118                     <child>
119                       <object class="GtkImageMenuItem" id="imagemenuitem2">
120                         <property name="label" translatable="yes" context="Second menu" comments="This one thing is for the second menu.">One thing</property>
121                         <property name="use_action_appearance">False</property>
122                         <property name="visible">True</property>
123                         <property name="can_focus">False</property>
124                         <property name="image">image2</property>
125                         <property name="use_stock">False</property>
126                       </object>
127                     </child>
128                     <child>
129                       <object class="GtkImageMenuItem" id="imagemenuitem3">
130                         <property name="label" translatable="yes" context="Second menu" comments="To you too.">Greetings</property>
131                         <property name="use_action_appearance">False</property>
132                         <property name="visible">True</property>
133                         <property name="can_focus">False</property>
134                         <property name="image">image3</property>
135                         <property name="use_stock">False</property>
136                       </object>
137                     </child>
138                   </object>
139                 </child>
140               </object>
141             </child>
142           </object>
143           <packing>
144             <property name="expand">False</property>
145             <property name="fill">True</property>
146             <property name="position">0</property>
147           </packing>
148         </child>
149         <child>
150           <object class="GtkTreeView" id="treeview2">
151             <property name="visible">True</property>
152             <property name="can_focus">True</property>
153             <property name="model">liststore</property>
154             <signal name="columns-changed" handler="myfunction_treeview_columns_changed" object="treeview-selection2" swapped="no"/>
155             <child internal-child="selection">
156               <object class="GtkTreeSelection" id="treeview-selection2"/>
157             </child>
158           </object>
159           <packing>
160             <property name="expand">True</property>
161             <property name="fill">True</property>
162             <property name="position">1</property>
163           </packing>
164         </child>
165         <child>
166           <object class="GtkButton" id="button">
167             <property name="label" translatable="yes" context="Button" comments="This one thing is the button.">One thing</property>
168             <property name="use_action_appearance">False</property>
169             <property name="visible">True</property>
170             <property name="can_focus">True</property>
171             <property name="receives_default">True</property>
172             <property name="use_action_appearance">False</property>
173           </object>
174           <packing>
175             <property name="expand">False</property>
176             <property name="fill">True</property>
177             <property name="position">2</property>
178           </packing>
179         </child>
180       </object>
181     </child>
182   </object>
183 </interface>
184 EOF
185
186 : ${XGETTEXT=xgettext}
187 ${XGETTEXT} -o - xg-gl-7.ui | grep -v 'POT-Creation-Date' > xg-gl-7.pot || exit 1
188
189 cat <<\EOF > xg-gl-7.ok
190 # SOME DESCRIPTIVE TITLE.
191 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
192 # This file is distributed under the same license as the PACKAGE package.
193 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
194 #
195 #, fuzzy
196 msgid ""
197 msgstr ""
198 "Project-Id-Version: PACKAGE VERSION\n"
199 "Report-Msgid-Bugs-To: \n"
200 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
201 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
202 "Language-Team: LANGUAGE <LL@li.org>\n"
203 "Language: \n"
204 "MIME-Version: 1.0\n"
205 "Content-Type: text/plain; charset=CHARSET\n"
206 "Content-Transfer-Encoding: 8bit\n"
207
208 #: xg-gl-7.ui:30 xg-gl-7.ui:45
209 msgctxt "First row"
210 msgid "Hi"
211 msgstr ""
212
213 #. A comment.
214 #. A multiline
215 #. comment.
216 #: xg-gl-7.ui:31 xg-gl-7.ui:46
217 msgid "Comment"
218 msgstr ""
219
220 #: xg-gl-7.ui:35
221 msgctxt "First row"
222 msgid "Hello"
223 msgstr ""
224
225 #. This is no translatable.
226 #: xg-gl-7.ui:36
227 msgid "Translatable comment."
228 msgstr ""
229
230 #: xg-gl-7.ui:41
231 msgctxt "This is not translatable"
232 msgid "Please..."
233 msgstr ""
234
235 #. This thing is the menu label
236 #: xg-gl-7.ui:67
237 msgctxt "Menu"
238 msgid "One thing"
239 msgstr ""
240
241 #. This thing is the label in the inner menu.
242 #: xg-gl-7.ui:75
243 msgctxt "One thing"
244 msgid "One thing"
245 msgstr ""
246
247 #. This is easy.
248 #: xg-gl-7.ui:92
249 msgctxt "Menu"
250 msgid "H_elp"
251 msgstr ""
252
253 #. This one thing is for the second menu.
254 #: xg-gl-7.ui:100
255 msgctxt "Second menu"
256 msgid "One thing"
257 msgstr ""
258
259 #. To you too.
260 #: xg-gl-7.ui:110
261 msgctxt "Second menu"
262 msgid "Greetings"
263 msgstr ""
264
265 #. This one thing is the button.
266 #: xg-gl-7.ui:147
267 msgctxt "Button"
268 msgid "One thing"
269 msgstr ""
270 EOF
271
272 : ${DIFF=diff}
273 ${DIFF} xg-gl-7.ok xg-gl-7.pot
274 result=$?
275
276 exit $result