summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/xgettext-glade-2
blob: 7b3fb0ffd37054188764d9af510d3b582d4e08cd (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
#!/bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src

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

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

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

cat <<\EOF > xg-gl-2-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

: ${XGETTEXT=xgettext}
${XGETTEXT} --add-comments -o xg-gl-2.tmp xg-gl-2-simple.glade  || exit 1
# Don't simplify this to "grep ... < xg-gl-2.tmp", otherwise OpenBSD 4.0 grep
# only outputs "Binary file (standard input) matches".
cat xg-gl-2.tmp | grep -v 'POT-Creation-Date' > xg-gl-2.pot

cat <<\EOF > xg-gl-2.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=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: xg-gl-2-simple.glade:13
msgid "Hello"
msgstr ""

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

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

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

exit $result