NetBSD/gnu/dist/gettext/gettext-tools/tests/format-c-5

57 lines
1.1 KiB
Bash

#! /bin/sh
# Test 'I' format directive flag.
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
tmpfiles="$tmpfiles fc5.pot"
: ${XGETTEXT=xgettext}
${XGETTEXT} -o fc5.pot --omit-header --no-location ${top_srcdir}/tests/format-c-5-prg.c
tmpfiles="$tmpfiles fc5.ok"
cat <<EOF > fc5.ok
#, c-format
msgid "father of %d children"
msgstr ""
EOF
: ${DIFF=diff}
${DIFF} fc5.ok fc5.pot || exit 1
tmpfiles="$tmpfiles fa.po"
# This should better be Farsi, not German. Can some translator help me?
cat <<EOF > fa.po
#, c-format
msgid "father of %d children"
msgstr "Vater von %Id Kindern"
EOF
tmpfiles="$tmpfiles fa"
test -d fa || mkdir fa
test -d fa/LC_MESSAGES || mkdir fa/LC_MESSAGES
: ${MSGFMT=msgfmt}
${MSGFMT} -o fa/LC_MESSAGES/fc5.mo fa.po
tmpfiles="$tmpfiles fa.po.tmp"
: ${MSGUNFMT=msgunfmt}
${MSGUNFMT} fa/LC_MESSAGES/fc5.mo -o fa.po.tmp
tmpfiles="$tmpfiles fa.po.strip"
sed 1d < fa.po > fa.po.strip
: ${DIFF=diff}
${DIFF} fa.po.strip fa.po.tmp || exit 1
LANGUAGE= ./fc5 fa_IR
case $? in
0) ;;
77) rm -fr $tmpfiles; exit 77;;
*) exit 1;;
esac
rm -fr $tmpfiles
exit 0