xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/tests/format-c-4 (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1#! /bin/sh
2
3# Test ISO C 99 <inttypes.h> format string directives with plural forms.
4
5tmpfiles=""
6trap 'rm -fr $tmpfiles' 1 2 3 15
7
8tmpfiles="$tmpfiles fc4.pot"
9: ${XGETTEXT=xgettext}
10${XGETTEXT} -o fc4.pot --omit-header --no-location ${top_srcdir}/tests/format-c-4-prg.c
11
12tmpfiles="$tmpfiles fc4.ok"
13cat <<EOF > fc4.ok
14#, c-format
15msgid "father of %<PRId8> child"
16msgid_plural "father of %<PRId8> children"
17msgstr[0] ""
18msgstr[1] ""
19EOF
20
21: ${DIFF=diff}
22${DIFF} fc4.ok fc4.pot || exit 1
23
24tmpfiles="$tmpfiles de.po"
25cat <<EOF > de.po
26#, c-format
27msgid "father of %<PRId8> child"
28msgid_plural "father of %<PRId8> children"
29msgstr[0] "Vater eines Kindes"
30msgstr[1] "Vater von %<PRId8> Kindern"
31EOF
32
33tmpfiles="$tmpfiles de"
34test -d de || mkdir de
35test -d de/LC_MESSAGES || mkdir de/LC_MESSAGES
36
37: ${MSGFMT=msgfmt}
38${MSGFMT} -o de/LC_MESSAGES/fc4.mo de.po
39
40tmpfiles="$tmpfiles de.po.tmp"
41: ${MSGUNFMT=msgunfmt}
42${MSGUNFMT} -o de.po.tmp de/LC_MESSAGES/fc4.mo
43
44: ${DIFF=diff}
45${DIFF} de.po de.po.tmp || exit 1
46
47LANGUAGE= ./fc4 de_DE
48result=$?
49
50rm -fr $tmpfiles
51
52exit $result
53