xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/tests/format-c-5 (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1#! /bin/sh
2
3# Test 'I' format directive flag.
4
5tmpfiles=""
6trap 'rm -fr $tmpfiles' 1 2 3 15
7
8tmpfiles="$tmpfiles fc5.pot"
9: ${XGETTEXT=xgettext}
10${XGETTEXT} -o fc5.pot --omit-header --no-location ${top_srcdir}/tests/format-c-5-prg.c
11
12tmpfiles="$tmpfiles fc5.ok"
13cat <<EOF > fc5.ok
14#, c-format
15msgid "father of %d children"
16msgstr ""
17EOF
18
19: ${DIFF=diff}
20${DIFF} fc5.ok fc5.pot || exit 1
21
22tmpfiles="$tmpfiles fa.po"
23# This should better be Farsi, not German. Can some translator help me?
24cat <<EOF > fa.po
25#, c-format
26msgid "father of %d children"
27msgstr "Vater von %Id Kindern"
28EOF
29
30tmpfiles="$tmpfiles fa"
31test -d fa || mkdir fa
32test -d fa/LC_MESSAGES || mkdir fa/LC_MESSAGES
33
34: ${MSGFMT=msgfmt}
35${MSGFMT} -o fa/LC_MESSAGES/fc5.mo fa.po
36
37tmpfiles="$tmpfiles fa.po.tmp"
38: ${MSGUNFMT=msgunfmt}
39${MSGUNFMT} -o fa.po.tmp fa/LC_MESSAGES/fc5.mo
40
41: ${DIFF=diff}
42${DIFF} fa.po fa.po.tmp || exit 1
43
44LANGUAGE= ./fc5 fa_IR
45case $? in
46  0) ;;
47  77)
48    if test -f /usr/bin/localedef; then
49      echo "Skipping test: locale fa_IR not installed"
50    else
51      echo "Skipping test: locale fa_IR not supported"
52    fi
53    rm -fr $tmpfiles; exit 77;;
54  *) exit 1;;
55esac
56
57rm -fr $tmpfiles
58
59exit 0
60