#! /bin/sh

# Test non-ASCII msgids when the PO file and the POT file are in different
# encodings.

tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15

tmpfiles="$tmpfiles mm-test16.po"
cat <<\EOF > mm-test16.po
msgid ""
msgstr ""
"Project-Id-Version: hello-cplusplus-qt 0\n"
"Report-Msgid-Bugs-To: bug-gnu-gettext@gnu.org\n"
"POT-Creation-Date: 2003-10-20 10:14+0200\n"
"PO-Revision-Date: 2003-10-20 10:13+0200\n"
"Last-Translator: Bruno Haible <bruno@clisp.org>\n"
"Language-Team: Polish <pl@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-2\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
"|| n%100>=20) ? 1 : 2);\n"

#: hello.cc:45
msgid "Written by François Pinard."
msgstr "Program napisa³ François Pinard."

#: hello.cc:52
msgid "error %1."
msgstr "b³±d %1."
EOF

tmpfiles="$tmpfiles mm-test16.pot"
cat <<EOF > mm-test16.pot
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Yoyodyne, Inc.
# 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: bug-gnu-gettext@gnu.org\n"
"POT-Creation-Date: 2003-10-20 10:14+0200\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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: hello.cc:45
msgid "Written by FranÃ§ois Pinard."
msgstr ""

#: hello.cc:52
msgid "error %1."
msgstr ""
EOF

tmpfiles="$tmpfiles mm-test16.new.po"
: ${MSGMERGE=msgmerge}
${MSGMERGE} -q -o mm-test16.new.po mm-test16.po mm-test16.pot
test $? = 0 || { rm -fr $tmpfiles; exit 1; }

tmpfiles="$tmpfiles mm-test16.ok"
cat <<\EOF > mm-test16.ok
msgid ""
msgstr ""
"Project-Id-Version: hello-cplusplus-qt 0\n"
"Report-Msgid-Bugs-To: bug-gnu-gettext@gnu.org\n"
"POT-Creation-Date: 2003-10-20 10:14+0200\n"
"PO-Revision-Date: 2003-10-20 10:13+0200\n"
"Last-Translator: Bruno Haible <bruno@clisp.org>\n"
"Language-Team: Polish <pl@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
"|| n%100>=20) ? 1 : 2);\n"

#: hello.cc:45
msgid "Written by FranÃ§ois Pinard."
msgstr "Program napisaÅ‚ FranÃ§ois Pinard."

#: hello.cc:52
msgid "error %1."
msgstr "bÅ‚Ä…d %1."
EOF

: ${DIFF=diff}
${DIFF} mm-test16.ok mm-test16.new.po
result=$?

rm -fr $tmpfiles

exit $result
