• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
8cat <<EOF > xg-gl-7-empty.glade
9<?xml version="1.0"?>
10<GTK-Interface/>
11EOF
12
13: ${XGETTEXT=xgettext}
14${XGETTEXT} -o xg-gl-7.pot xg-gl-7-empty.glade 2>/dev/null
15test $? = 0 || {
16  echo "Skipping test: xgettext was built without Glade support"
17  Exit 77
18}
19
20cat <<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>
184EOF
185
186: ${XGETTEXT=xgettext}
187${XGETTEXT} -o xg-gl-7.tmp xg-gl-7.ui || Exit 1
188func_filter_POT_Creation_Date xg-gl-7.tmp xg-gl-7.pot
189
190cat <<\EOF > xg-gl-7.ok
191# SOME DESCRIPTIVE TITLE.
192# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
193# This file is distributed under the same license as the PACKAGE package.
194# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
195#
196#, fuzzy
197msgid ""
198msgstr ""
199"Project-Id-Version: PACKAGE VERSION\n"
200"Report-Msgid-Bugs-To: \n"
201"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
202"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
203"Language-Team: LANGUAGE <LL@li.org>\n"
204"Language: \n"
205"MIME-Version: 1.0\n"
206"Content-Type: text/plain; charset=CHARSET\n"
207"Content-Transfer-Encoding: 8bit\n"
208
209#: xg-gl-7.ui:30 xg-gl-7.ui:45
210msgctxt "First row"
211msgid "Hi"
212msgstr ""
213
214#. A comment.
215#. A multiline
216#. comment.
217#: xg-gl-7.ui:31 xg-gl-7.ui:46
218msgid "Comment"
219msgstr ""
220
221#: xg-gl-7.ui:35
222msgctxt "First row"
223msgid "Hello"
224msgstr ""
225
226#. This is no translatable.
227#: xg-gl-7.ui:36
228msgid "Translatable comment."
229msgstr ""
230
231#: xg-gl-7.ui:41
232msgctxt "This is not translatable"
233msgid "Please..."
234msgstr ""
235
236#. This thing is the menu label
237#: xg-gl-7.ui:67
238msgctxt "Menu"
239msgid "One thing"
240msgstr ""
241
242#. This thing is the label in the inner menu.
243#: xg-gl-7.ui:75
244msgctxt "One thing"
245msgid "One thing"
246msgstr ""
247
248#. This is easy.
249#: xg-gl-7.ui:92
250msgctxt "Menu"
251msgid "H_elp"
252msgstr ""
253
254#. This one thing is for the second menu.
255#: xg-gl-7.ui:100
256msgctxt "Second menu"
257msgid "One thing"
258msgstr ""
259
260#. To you too.
261#: xg-gl-7.ui:110
262msgctxt "Second menu"
263msgid "Greetings"
264msgstr ""
265
266#. This one thing is the button.
267#: xg-gl-7.ui:147
268msgctxt "Button"
269msgid "One thing"
270msgstr ""
271EOF
272
273: ${DIFF=diff}
274${DIFF} xg-gl-7.ok xg-gl-7.pot
275result=$?
276
277exit $result
278