7b3fb0ffd37054188764d9af510d3b582d4e08cd
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-glade-2
1 #!/bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test of Glade support, in particular ISO-8859-1 to UTF-8 conversion
5 # and ASCII entities (< > ").
6
7 cat <<EOF > xg-gl-2-empty.glade
8 <?xml version="1.0"?>
9 <GTK-Interface/>
10 EOF
11
12 : ${XGETTEXT=xgettext}
13 ${XGETTEXT} -o xg-gl-2.pot xg-gl-2-empty.glade 2>/dev/null
14 test $? = 0 || {
15   echo "Skipping test: xgettext was built without Glade support"
16   exit 77
17 }
18
19 cat <<\EOF > xg-gl-2-simple.glade
20 <?xml version="1.0" encoding="ISO-8859-1"?>
21 <GTK-Interface>
22
23
24 <widget>
25   <class>GtkWindow</class>
26   <name>HelloWindow</name>
27   <border_width>5</border_width>
28   <Signal>
29     <name>destroy</name>
30     <handler>gtk_main_quit</handler>
31   </Signal>
32   <title>Hello</title>
33   <type>GTK_WINDOW_TOPLEVEL</type>
34   <position>GTK_WIN_POS_NONE</position>
35   <allow_shrink>True</allow_shrink>
36   <allow_grow>True</allow_grow>
37   <auto_shrink>False</auto_shrink>
38
39   <widget>
40     <class>GtkButton</class>
41     <name>Hello World</name>
42     <can_focus>True</can_focus>
43     <Signal>
44       <name>clicked</name>
45       <handler>gtk_widget_destroy</handler>
46       <object>HelloWindow</object>
47     </Signal>
48     <!-- Der übliche Programm-Gruß -->
49     <label>Hello World</label>
50     <comments>This &lt;button&gt; displays &quot;Hello World&quot;.</comments>
51   </widget>
52 </widget>
53
54 </GTK-Interface>
55 EOF
56
57 : ${XGETTEXT=xgettext}
58 ${XGETTEXT} --add-comments -o xg-gl-2.tmp xg-gl-2-simple.glade  || exit 1
59 # Don't simplify this to "grep ... < xg-gl-2.tmp", otherwise OpenBSD 4.0 grep
60 # only outputs "Binary file (standard input) matches".
61 cat xg-gl-2.tmp | grep -v 'POT-Creation-Date' > xg-gl-2.pot
62
63 cat <<\EOF > xg-gl-2.ok
64 # SOME DESCRIPTIVE TITLE.
65 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
66 # This file is distributed under the same license as the PACKAGE package.
67 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
68 #
69 #, fuzzy
70 msgid ""
71 msgstr ""
72 "Project-Id-Version: PACKAGE VERSION\n"
73 "Report-Msgid-Bugs-To: \n"
74 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
75 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
76 "Language-Team: LANGUAGE <LL@li.org>\n"
77 "Language: \n"
78 "MIME-Version: 1.0\n"
79 "Content-Type: text/plain; charset=UTF-8\n"
80 "Content-Transfer-Encoding: 8bit\n"
81
82 #: xg-gl-2-simple.glade:13
83 msgid "Hello"
84 msgstr ""
85
86 #. Der übliche Programm-Gruß
87 #: xg-gl-2-simple.glade:30
88 msgid "Hello World"
89 msgstr ""
90
91 #: xg-gl-2-simple.glade:31
92 msgid "This <button> displays \"Hello World\"."
93 msgstr ""
94 EOF
95
96 : ${DIFF=diff}
97 ${DIFF} xg-gl-2.ok xg-gl-2.pot
98 result=$?
99
100 exit $result