blob: b541843f8c6d251807f388c6582396472162ea43 (
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
|
#!/bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src
# Test of GtkBuilder support.
# Checks that the extracted pot contains the right translatable
# content, comments and context.
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
tmpfiles="$tmpfiles xg-gl-6-empty.glade"
cat <<EOF > xg-gl-6-empty.glade
<?xml version="1.0"?>
<GTK-Interface/>
EOF
tmpfiles="$tmpfiles xg-gl-6.pot"
: ${XGETTEXT=xgettext}
${XGETTEXT} -o xg-gl-6.pot xg-gl-6-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-6.ui"
cat <<EOF > xg-gl-6.ui
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="window">
<property name="can_focus">False</property>
<property name="title" translatable="yes" context="This is the context for this text" comments="This is a comment for empty window">This is an empty window</property>
<child>
<placeholder/>
</child>
</object>
</interface>
EOF
tmpfiles="$tmpfiles xg-gl-6.pot"
: ${XGETTEXT=xgettext}
${XGETTEXT} -o - xg-gl-6.ui | grep -v 'POT-Creation-Date' > xg-gl-6.pot
test $? = 0 || { rm -fr $tmpfiles; exit 1; }
tmpfiles="$tmpfiles xg-gl-6.ok"
cat <<EOF > xg-gl-6.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"
#. This is a comment for empty window
#: xg-gl-6.ui:6
msgctxt "This is the context for this text"
msgid "This is an empty window"
msgstr ""
EOF
: ${DIFF=diff}
${DIFF} xg-gl-6.ok xg-gl-6.pot
result=$?
test $result = 0 || {
rm -fr $tmpfiles; exit $result
}
# Check with --extract-all option.
${XGETTEXT} -a -o - xg-gl-6.ui | grep -v 'POT-Creation-Date' > xg-gl-6.pot
test $? = 0 || { rm -fr $tmpfiles; exit 1; }
# Must be ignored.
${DIFF} xg-gl-6.ok xg-gl-6.pot
result=$?
rm -fr $tmpfiles
exit $result
|