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

56 lines
1.1 KiB
Bash

#! /bin/sh
# Test ISO C 99 <inttypes.h> format string directives with plural forms.
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
tmpfiles="$tmpfiles fc4.pot"
: ${XGETTEXT=xgettext}
${XGETTEXT} -o fc4.pot --omit-header --no-location ${top_srcdir}/tests/format-c-4-prg.c
tmpfiles="$tmpfiles fc4.ok"
cat <<EOF > fc4.ok
#, c-format
msgid "father of %<PRId8> child"
msgid_plural "father of %<PRId8> children"
msgstr[0] ""
msgstr[1] ""
EOF
: ${DIFF=diff}
${DIFF} fc4.ok fc4.pot || exit 1
tmpfiles="$tmpfiles de.po"
cat <<EOF > de.po
#, c-format
msgid "father of %<PRId8> child"
msgid_plural "father of %<PRId8> children"
msgstr[0] "Vater eines Kindes"
msgstr[1] "Vater von %<PRId8> Kindern"
EOF
tmpfiles="$tmpfiles de"
test -d de || mkdir de
test -d de/LC_MESSAGES || mkdir de/LC_MESSAGES
: ${MSGFMT=msgfmt}
${MSGFMT} -o de/LC_MESSAGES/fc4.mo de.po
tmpfiles="$tmpfiles de.po.tmp"
: ${MSGUNFMT=msgunfmt}
${MSGUNFMT} de/LC_MESSAGES/fc4.mo -o de.po.tmp
tmpfiles="$tmpfiles de.po.strip"
sed 1d < de.po > de.po.strip
: ${DIFF=diff}
${DIFF} de.po.strip de.po.tmp || exit 1
LANGUAGE= ./fc4 de_DE
result=$?
rm -fr $tmpfiles
exit $result