#! /bin/sh

# Test --extracted-comment option.

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

tmpfiles="$tmpfiles mg-test8.po"
cat <<\EOF > mg-test8.po
msgid ""
msgstr ""
"Project-Id-Version: GNU gettext 0.11-pre1\n"
"POT-Creation-Date: 2001-12-08 20:33+0100\n"
"PO-Revision-Date: 2001-11-04 12:25+0100\n"
"Last-Translator: Karl Eichwalder <ke@suse.de>\n"
"Language-Team: German <de@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

# Warum ist das nicht als c-form markiert?
#: widgets.c:87
msgid "About <tt>GNOME</tt>"
msgstr "Über <tt>GNOME</tt>"

#. c-form
#: widgets.c:118
msgid "click <b>here</b>"
msgstr "Klicken Sie <b>hier</b>."

#: widgets.c:152
#, c-format
msgid "repeat %d times"
msgstr "%d mal wiederholen"
EOF

tmpfiles="$tmpfiles mg-test8.out mg-test8.err"
: ${MSGGREP=msggrep}
LC_MESSAGES=C LC_ALL= \
${MSGGREP} -X -e c-form -o mg-test8.out mg-test8.po >mg-test8.err 2>&1
result=$?
cat mg-test8.err | grep -v 'warning: Locale charset' | grep -v '^ '
test $result = 0 || { rm -fr $tmpfiles; exit 1; }

tmpfiles="$tmpfiles mg-test8.ok"
cat <<\EOF > mg-test8.ok
msgid ""
msgstr ""
"Project-Id-Version: GNU gettext 0.11-pre1\n"
"POT-Creation-Date: 2001-12-08 20:33+0100\n"
"PO-Revision-Date: 2001-11-04 12:25+0100\n"
"Last-Translator: Karl Eichwalder <ke@suse.de>\n"
"Language-Team: German <de@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. c-form
#: widgets.c:118
msgid "click <b>here</b>"
msgstr "Klicken Sie <b>hier</b>."
EOF

: ${DIFF=diff}
${DIFF} mg-test8.ok mg-test8.out
result=$?

rm -fr $tmpfiles

exit $result
