summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/xgettext-glade-4
blob: 374742a62aef7a4727648e688e44c33b63ce4b69 (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
#!/bin/sh

# Test of Glade 2 support.

tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15

tmpfiles="$tmpfiles empty.glade"
cat <<EOF > empty.glade
<?xml version="1.0"?>
<GTK-Interface/>
EOF

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

tmpfiles="$tmpfiles xg-gl-4.glade"
cat <<EOF > xg-gl-4.glade
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.3 on Sat May 16 19:53:48 2009 -->
<glade-interface>
  <widget class="GtkWindow" id="mainWindow">
    <child>
      <widget class="GtkButton" id="FormButton">
        <property name="visible">True</property>
        <property name="can_focus">True</property>
        <property name="receives_default">True</property>
        <property name="label" translatable="yes" comments="Form means shape here">Form</property>
        <property name="response_id">0</property>
      </widget>
    </child>
  </widget>
</glade-interface>
EOF

tmpfiles="$tmpfiles xg-gl-4.tmp xg-gl-4.pot"
: ${XGETTEXT=xgettext}
${XGETTEXT} -o xg-gl-4.tmp xg-gl-4.glade
test $? = 0 || { rm -fr $tmpfiles; exit 1; }
# Don't simplify this to "grep ... < xg-gl-4.tmp", otherwise OpenBSD 4.0 grep
# only outputs "Binary file (standard input) matches".
cat xg-gl-4.tmp | grep -v 'POT-Creation-Date' > xg-gl-4.pot

tmpfiles="$tmpfiles xg-gl-4.ok"
cat <<\EOF > xg-gl-4.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"

#. Form means shape here
#: xg-gl-4.glade:11
msgid "Form"
msgstr ""
EOF

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

test $result = 0 || {
    rm -fr $tempfiles; exit $result
}

tmpfiles="$tmpfiles xg-gl-4a.glade"
cat <<EOF > xg-gl-4a.glade
<?xml version="1.0"?>
<glade-interface>
  <!-- interface-requires gtk+ 2.6 -->
  <!-- interface-naming-policy toplevel-contextual -->
  <widget class="GtkWindow" id="mainWindow">
    <accessibility>
      <atkproperty name="AtkObject::accessible-name" translatable="yes" comments="Also has comments">This window</atkproperty>
    </accessibility>
    <child>
      <placeholder/>
    </child>
  </widget>
</glade-interface>
EOF

tmpfiles="$tmpfiles xg-gl-4a.tmp xg-gl-4a.pot"
: ${XGETTEXT=xgettext}
${XGETTEXT} -o xg-gl-4a.tmp xg-gl-4a.glade
test $? = 0 || { rm -fr $tmpfiles; exit 1; }
# Look upwards
cat xg-gl-4a.tmp | grep -v 'POT-Creation-Date' > xg-gl-4a.pot

tmpfiles="$tmpfiles xg-gl-4a.ok"
cat <<\EOF > xg-gl-4a.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"

#. Also has comments
#: xg-gl-4a.glade:7
msgid "This window"
msgstr ""
EOF

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

rm -fr $tmpfiles

exit $result