2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
4 # Test Python support: --from-code option and encoding recognition.
6 cat <<\EOF > xg-py-3a.py
8 # TRANSLATORS: Fran
\8f«®ois Pinard is a hero.
9 print gettext.gettext("ÆüËܸì");
12 cat <<\EOF > xg-py-3b.py
14 # Hey Emacs! -*- coding: euc-jp -*-
15 # TRANSLATORS: Fran
\8f«®ois Pinard is a hero.
16 print gettext.gettext("ÆüËܸì");
19 cat <<\EOF > xg-py-3.ok
20 # SOME DESCRIPTIVE TITLE.
21 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
22 # This file is distributed under the same license as the PACKAGE package.
23 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
28 "Project-Id-Version: PACKAGE VERSION\n"
29 "Report-Msgid-Bugs-To: \n"
30 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
31 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
32 "Language-Team: LANGUAGE <LL@li.org>\n"
35 "Content-Type: text/plain; charset=UTF-8\n"
36 "Content-Transfer-Encoding: 8bit\n"
38 #. TRANSLATORS: François Pinard is a hero.
43 # Verify that if the source file has no magic coding comment, xgettext fails
44 # if no --from-code option is given but succeeds if it is given.
45 : ${XGETTEXT=xgettext}
46 ${XGETTEXT} --add-comments=TRANSLATORS: --no-location \
47 -d xg-py-3a xg-py-3a.py > /dev/null 2>&1
48 test $? = 1 || { exit 1; }
49 ${XGETTEXT} --add-comments=TRANSLATORS: --no-location --from-code=euc-jp \
50 -o xg-py-3a.tmp xg-py-3a.py || exit 1
51 # Don't simplify this to "grep ... < xg-py-3a.tmp", otherwise OpenBSD 4.0 grep
52 # only outputs "Binary file (standard input) matches".
53 cat xg-py-3a.tmp | grep -v 'POT-Creation-Date' | LC_ALL=C tr -d '\r' > xg-py-3a.pot
56 ${DIFF} xg-py-3.ok xg-py-3a.pot || exit 1
58 # Verify that if the source file has a magic coding comment, xgettext succeeds.
60 ${XGETTEXT} --add-comments=TRANSLATORS: --no-location \
61 -o xg-py-3b.tmp xg-py-3b.py || exit 1
62 # Don't simplify this to "grep ... < xg-py-3b.tmp", otherwise OpenBSD 4.0 grep
63 # only outputs "Binary file (standard input) matches".
64 cat xg-py-3b.tmp | grep -v 'POT-Creation-Date' | LC_ALL=C tr -d '\r' > xg-py-3b.pot
66 ${DIFF} xg-py-3.ok xg-py-3b.pot || exit 1
68 # Verify that if the source file has a magic coding comment and a --from-code
69 # option is given, the magic coding comment takes precedence over it.
71 ${XGETTEXT} --add-comments=TRANSLATORS: --no-location --from-code=iso-8859-1 \
72 -o xg-py-3c.tmp xg-py-3b.py || exit 1
73 # Don't simplify this to "grep ... < xg-py-3c.tmp", otherwise OpenBSD 4.0 grep
74 # only outputs "Binary file (standard input) matches".
75 cat xg-py-3c.tmp | grep -v 'POT-Creation-Date' | LC_ALL=C tr -d '\r' > xg-py-3c.pot
77 ${DIFF} xg-py-3.ok xg-py-3c.pot || exit 1
79 # Verify that backslashes in and second bytes with value 0x5C are correctly
80 # distinguished in weird encodings like BIG5.
82 cat <<\EOF > xg-py-3d.py
84 # Hey Emacs! -*- coding: big5 -*-
85 print gettext.gettext(u"¬\u0021");
86 print gettext.gettext(u"¬\\u0021");
89 ${XGETTEXT} --add-comments=TRANSLATORS: \
90 -o xg-py-3d.tmp xg-py-3d.py || exit 1
91 # Don't simplify this to "grep ... < xg-py-3d.tmp", otherwise OpenBSD 4.0 grep
92 # only outputs "Binary file (standard input) matches".
93 cat xg-py-3d.tmp | grep -v 'POT-Creation-Date' | LC_ALL=C tr -d '\r' > xg-py-3d.pot
95 cat <<\EOF > xg-py-3d.ok
96 # SOME DESCRIPTIVE TITLE.
97 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
98 # This file is distributed under the same license as the PACKAGE package.
99 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
104 "Project-Id-Version: PACKAGE VERSION\n"
105 "Report-Msgid-Bugs-To: \n"
106 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
107 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
108 "Language-Team: LANGUAGE <LL@li.org>\n"
110 "MIME-Version: 1.0\n"
111 "Content-Type: text/plain; charset=UTF-8\n"
112 "Content-Transfer-Encoding: 8bit\n"
123 ${DIFF} xg-py-3d.ok xg-py-3d.pot || exit 1