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

# Test of Glade support, in particular ISO-8859-1 to UTF-8 conversion
# and ASCII entities (< > ").

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-test20.pot"
: ${XGETTEXT=xgettext}
${XGETTEXT} -o xg-test20.pot empty.glade 2>/dev/null
test $? = 0 || { rm -fr $tmpfiles; exit 77; }

tmpfiles="$tmpfiles simple.glade"
cat <<\EOF > simple.glade
<?xml version="1.0" encoding="ISO-8859-1"?>
<GTK-Interface>


<widget>
  <class>GtkWindow</class>
  <name>HelloWindow</name>
  <border_width>5</border_width>
  <Signal>
    <name>destroy</name>
    <handler>gtk_main_quit</handler>
  </Signal>
  <title>Hello</title>
  <type>GTK_WINDOW_TOPLEVEL</type>
  <position>GTK_WIN_POS_NONE</position>
  <allow_shrink>True</allow_shrink>
  <allow_grow>True</allow_grow>
  <auto_shrink>False</auto_shrink>

  <widget>
    <class>GtkButton</class>
    <name>Hello World</name>
    <can_focus>True</can_focus>
    <Signal>
      <name>clicked</name>
      <handler>gtk_widget_destroy</handler>
      <object>HelloWindow</object>
    </Signal>
    <!-- Der übliche Programm-Gruß -->
    <label>Hello World</label>
    <comments>This &lt;button&gt; displays &quot;Hello World&quot;.</comments>
  </widget>
</widget>

</GTK-Interface>
EOF

tmpfiles="$tmpfiles xg-test20.tmp xg-test20.pot"
: ${XGETTEXT=xgettext}
${XGETTEXT} --add-comments -o xg-test20.tmp simple.glade 
test $? = 0 || { rm -fr $tmpfiles; exit 1; }
grep -v 'POT-Creation-Date' < xg-test20.tmp > xg-test20.pot

tmpfiles="$tmpfiles xg-test20.ok"
cat <<EOF > xg-test20.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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: simple.glade:13
msgid "Hello"
msgstr ""

#. Der übliche Programm-Gruß
#: simple.glade:30
msgid "Hello World"
msgstr ""

#: simple.glade:31
msgid "This <button> displays \"Hello World\"."
msgstr ""
EOF

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

rm -fr $tmpfiles

exit $result