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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
|
#! /bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src
# Test Python support: bytes and strings with hexadecimal escape sequences that
# are invalid UTF-8.
cat <<\EOF > xg-py-5-b.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"
msgid "ŕ"
msgstr ""
EOF
cat <<\EOF > xg-py-5-u.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"
msgid "à"
msgstr ""
EOF
: ${XGETTEXT=xgettext}
: ${DIFF=diff}
# With the encoding set to ISO-8859-2 on the command line:
cat <<\EOF > xg-py-5-b1.py
_(b"\xE0")
EOF
${XGETTEXT} --no-location -o xg-py-5-b1.tmp --from-code=iso-8859-2 xg-py-5-b1.py 2>xg-py-5-b1.err
test $? = 0 || { cat xg-py-5-b1.err; Exit 1; }
func_filter_POT_Creation_Date xg-py-5-b1.tmp xg-py-5-b1.pot
${DIFF} xg-py-5-b.ok xg-py-5-b1.pot || Exit 1
# With the encoding set to ISO-8859-2 inside the source file:
cat <<\EOF > xg-py-5-b2.py
# -*- coding: iso-8859-2 -*-
_(b"\xE0")
EOF
${XGETTEXT} --no-location -o xg-py-5-b2.tmp xg-py-5-b2.py 2>xg-py-5-b2.err
test $? = 0 || { cat xg-py-5-b2.err; Exit 1; }
func_filter_POT_Creation_Date xg-py-5-b2.tmp xg-py-5-b2.pot
${DIFF} xg-py-5-b.ok xg-py-5-b2.pot || Exit 1
# With the encoding being UTF-8 by default:
cat <<\EOF > xg-py-5-b3.py
_(b"\xE0")
EOF
LANGUAGE= LC_ALL=C ${XGETTEXT} --no-location -o xg-py-5-b3.tmp xg-py-5-b3.py 2>xg-py-5-b3.err
result=$?
cat xg-py-5-b3.err
test $result = 1 || Exit 1
grep 'is not UTF-8 encoded' xg-py-5-b3.err >/dev/null || Exit 1
# With the encoding set to ISO-8859-1 on the command line:
cat <<\EOF > xg-py-5-u1.py
_("\xE0")
EOF
${XGETTEXT} --no-location -o xg-py-5-u1.tmp --from-code=iso-8859-2 xg-py-5-u1.py 2>xg-py-5-u1.err
test $? = 0 || { cat xg-py-5-u1.err; Exit 1; }
func_filter_POT_Creation_Date xg-py-5-u1.tmp xg-py-5-u1.pot
${DIFF} xg-py-5-u.ok xg-py-5-u1.pot || Exit 1
# With the encoding set to ISO-8859-1 inside the source file:
cat <<\EOF > xg-py-5-u2.py
# -*- coding: iso-8859-1 -*-
_("\xE0")
EOF
${XGETTEXT} --no-location -o xg-py-5-u2.tmp xg-py-5-u2.py 2>xg-py-5-u2.err
test $? = 0 || { cat xg-py-5-u2.err; Exit 1; }
func_filter_POT_Creation_Date xg-py-5-u2.tmp xg-py-5-u2.pot
${DIFF} xg-py-5-u.ok xg-py-5-u2.pot || Exit 1
# With the encoding being UTF-8 by default:
cat <<\EOF > xg-py-5-u3.py
_("\xE0")
EOF
${XGETTEXT} --no-location -o xg-py-5-u3.tmp xg-py-5-u3.py 2>xg-py-5-u3.err
test $? = 0 || { cat xg-py-5-u3.err; Exit 1; }
func_filter_POT_Creation_Date xg-py-5-u3.tmp xg-py-5-u3.pot
${DIFF} xg-py-5-u.ok xg-py-5-u3.pot || Exit 1
exit 0
|