#! /bin/sh
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
tmpfiles="$tmpfiles f-j-2.data"
cat <<\EOF > f-j-2.data
msgid "abc{0}def"
msgstr "abc{"
msgid "abc{1}def"
msgstr "xyz{1}"
msgid "abc{1}def"
msgstr "xyz{01}"
msgid "abc{2}{0}{1}def"
msgstr "xyz{1}{0}{2}"
msgid "abc{1}def{0}"
msgstr "xyz{0}"
msgid "abc{0}def"
msgstr "xyz{0}uvw{1}"
msgid "abc{1}def{0}"
msgstr "xyz{1}"
msgid "abc{1}def"
msgstr "xyz{0}{1}"
msgid "abc{500000000}def"
msgstr "xyz{500000001}"
msgid "abc{1,number}"
msgstr "xyz{1,choice,0#zero|1#{1,number}}"
msgid "abc{1,number}"
msgstr "xyz{1,number,currency}"
msgid "abc{1,number}"
msgstr "xyz{1,number,percent}"
msgid "abc{1,number}"
msgstr "xyz{1,number,integer}"
msgid "abc{1,number}"
msgstr "xyz{1,number,###,##0}"
msgid "abc{1,date}"
msgstr "xyz{1,time}"
msgid "abc{1,date}"
msgstr "xyz{1,date,short}"
msgid "abc{1,date}"
msgstr "xyz{1,date,medium}"
msgid "abc{1,date}"
msgstr "xyz{1,date,long}"
msgid "abc{1,date}"
msgstr "xyz{1,date,full}"
msgid "abc{1,date}"
msgstr "xyz{1,date,yyyy-MM-dd}"
msgid "abc{1,time}"
msgstr "xyz{1,time,short}"
msgid "abc{1,time}"
msgstr "xyz{1,time,medium}"
msgid "abc{1,time}"
msgstr "xyz{1,time,long}"
msgid "abc{1,time}"
msgstr "xyz{1,time,full}"
msgid "abc{1,time}"
msgstr "xyz{1,time,}"
msgid "abc{1,time}"
msgstr "xyz{1,time,hh:mm:ss}"
msgid "abc{1}"
msgstr "xyz{1,number}"
msgid "abc{1}"
msgstr "xyz{1,date}"
msgid "abc{1,time}"
msgstr "xyz{1,number}"
msgid "abc{1,number}"
msgstr "xyz{1,date}"
msgid "abc{1}"
msgstr "xyz{1,choice,0#zero|1#{1,number}}"
msgid "abc{1}"
msgstr "xyz{1,choice,0#zero|1#{0,number}}"
msgid "abc{0,number}{1}"
msgstr "xyz{0,choice,0#zero|1#{1,number}}"
EOF
: ${MSGFMT=msgfmt}
n=0
while read comment; do
read msgid_line
read msgstr_line
n=`expr $n + 1`
tmpfiles="$tmpfiles f-j-2-$n.po f-j-2-$n.mo"
cat <<EOF > f-j-2-$n.po
${msgid_line}
${msgstr_line}
EOF
fail=
if echo "$comment" | grep 'Valid:' > /dev/null; then
if ${MSGFMT} --check-format -o f-j-2-$n.mo f-j-2-$n.po; then
:
else
fail=yes
fi
else
${MSGFMT} --check-format -o f-j-2-$n.mo f-j-2-$n.po 2> /dev/null
if test $? = 1; then
:
else
fail=yes
fi
fi
if test -n "$fail"; then
echo "Format string checking error:" 1>&2
cat f-j-2-$n.po 1>&2
exit 1
fi
rm -f f-j-2-$n.po f-j-2-$n.mo
done < f-j-2.data
rm -fr $tmpfiles
exit 0