summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/xgettext-glade-7
blob: d037415b597ceb7419fc5dfab5c003fddd5f3954 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
#!/bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src

# Test of GtkBuilder support.
# Checks the extraction of a medium size GtkBuilder file, with
# comments, context and translatable and not translatable content.

cat <<EOF > xg-gl-7-empty.glade
<?xml version="1.0"?>
<GTK-Interface/>
EOF

: ${XGETTEXT=xgettext}
${XGETTEXT} -o xg-gl-7.pot xg-gl-7-empty.glade 2>/dev/null
test $? = 0 || {
  echo "Skipping test: xgettext was built without Glade support"
  exit 77
}

cat <<EOF > xg-gl-7.ui
<?xml version="1.0" encoding="UTF-8"?>
<interface>
  <!-- interface-requires gtk+ 3.0 -->
  <object class="GtkImage" id="image1">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="stock">gtk-about</property>
  </object>
  <object class="GtkImage" id="image2">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="stock">gtk-help</property>
  </object>
  <object class="GtkImage" id="image3">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="stock">gtk-connect</property>
  </object>
  <object class="GtkListStore" id="liststore">
    <columns>
      <!-- column-name first column -->
      <column type="gchararray"/>
      <!-- column-name second column -->
      <column type="gchararray"/>
      <!-- column-name not extracted column -->
      <column type="guint64"/>
    </columns>
    <data>
      <row>
        <col id="0" translatable="yes" context="First row">Hi</col>
        <col id="1" translatable="yes" comments="A comment.">Comment</col>
        <col id="2">999</col>
      </row>
      <row>
        <col id="0" translatable="yes" context="First row">Hello</col>
        <col id="1" translatable="yes" comments="This is no translatable.">Translatable comment.</col>
        <col id="2">88</col>
      </row>
      <row>
        <col id="0" translatable="no" context="First row" comments="Yeah">Oi</col>
        <col id="1" translatable="yes" context="This is not translatable">Please...</col>
        <col id="2">86855555</col>
      </row>
      <row>
        <col id="0" translatable="yes" context="First row">Hi</col>
        <col id="1" translatable="yes" comments="A multiline&#10;comment.">Comment</col>
        <col id="2">999</col>
      </row>
    </data>
  </object>
  <object class="GtkWindow" id="window">
    <property name="can_focus">False</property>
    <child>
      <object class="GtkBox" id="box">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="orientation">vertical</property>
        <child>
          <object class="GtkMenuBar" id="menubar">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <child>
              <object class="GtkMenuItem" id="menuitem1">
                <property name="use_action_appearance">False</property>
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes" context="Menu" comments="This thing is the menu label">One thing</property>
                <property name="use_underline">True</property>
                <child type="submenu">
                  <object class="GtkMenu" id="menu1">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <child>
                      <object class="GtkImageMenuItem" id="imagemenuitem1">
                        <property name="label" translatable="yes" context="One thing" comments="This thing is the label in the inner menu.">One thing</property>
                        <property name="use_action_appearance">False</property>
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="image">image1</property>
                        <property name="use_stock">False</property>
                      </object>
                    </child>
                  </object>
                </child>
              </object>
            </child>
            <child>
              <object class="GtkMenuItem" id="menuitem2">
                <property name="use_action_appearance">False</property>
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes" context="Menu" comments="This is easy.">H_elp</property>
                <property name="use_underline">True</property>
                <child type="submenu">
                  <object class="GtkMenu" id="menu2">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <child>
                      <object class="GtkImageMenuItem" id="imagemenuitem2">
                        <property name="label" translatable="yes" context="Second menu" comments="This one thing is for the second menu.">One thing</property>
                        <property name="use_action_appearance">False</property>
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="image">image2</property>
                        <property name="use_stock">False</property>
                      </object>
                    </child>
                    <child>
                      <object class="GtkImageMenuItem" id="imagemenuitem3">
                        <property name="label" translatable="yes" context="Second menu" comments="To you too.">Greetings</property>
                        <property name="use_action_appearance">False</property>
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="image">image3</property>
                        <property name="use_stock">False</property>
                      </object>
                    </child>
                  </object>
                </child>
              </object>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">0</property>
          </packing>
        </child>
        <child>
          <object class="GtkTreeView" id="treeview2">
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="model">liststore</property>
            <signal name="columns-changed" handler="myfunction_treeview_columns_changed" object="treeview-selection2" swapped="no"/>
            <child internal-child="selection">
              <object class="GtkTreeSelection" id="treeview-selection2"/>
            </child>
          </object>
          <packing>
            <property name="expand">True</property>
            <property name="fill">True</property>
            <property name="position">1</property>
          </packing>
        </child>
        <child>
          <object class="GtkButton" id="button">
            <property name="label" translatable="yes" context="Button" comments="This one thing is the button.">One thing</property>
            <property name="use_action_appearance">False</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
            <property name="use_action_appearance">False</property>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">2</property>
          </packing>
        </child>
      </object>
    </child>
  </object>
</interface>
EOF

: ${XGETTEXT=xgettext}
${XGETTEXT} -o - xg-gl-7.ui | grep -v 'POT-Creation-Date' > xg-gl-7.pot || exit 1

cat <<\EOF > xg-gl-7.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-7.ui:30 xg-gl-7.ui:45
msgctxt "First row"
msgid "Hi"
msgstr ""

#. A comment.
#. A multiline
#. comment.
#: xg-gl-7.ui:31 xg-gl-7.ui:46
msgid "Comment"
msgstr ""

#: xg-gl-7.ui:35
msgctxt "First row"
msgid "Hello"
msgstr ""

#. This is no translatable.
#: xg-gl-7.ui:36
msgid "Translatable comment."
msgstr ""

#: xg-gl-7.ui:41
msgctxt "This is not translatable"
msgid "Please..."
msgstr ""

#. This thing is the menu label
#: xg-gl-7.ui:67
msgctxt "Menu"
msgid "One thing"
msgstr ""

#. This thing is the label in the inner menu.
#: xg-gl-7.ui:75
msgctxt "One thing"
msgid "One thing"
msgstr ""

#. This is easy.
#: xg-gl-7.ui:92
msgctxt "Menu"
msgid "H_elp"
msgstr ""

#. This one thing is for the second menu.
#: xg-gl-7.ui:100
msgctxt "Second menu"
msgid "One thing"
msgstr ""

#. To you too.
#: xg-gl-7.ui:110
msgctxt "Second menu"
msgid "Greetings"
msgstr ""

#. This one thing is the button.
#: xg-gl-7.ui:147
msgctxt "Button"
msgid "One thing"
msgstr ""
EOF

: ${DIFF=diff}
${DIFF} xg-gl-7.ok xg-gl-7.pot
result=$?

exit $result