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