Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / format-c-5
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test 'I' format directive flag.
5
6 : ${XGETTEXT=xgettext}
7 ${XGETTEXT} -o fc5.tmp --omit-header --no-location "$abs_srcdir"/format-c-5-prg.c || exit 1
8 LC_ALL=C tr -d '\r' < fc5.tmp > fc5.pot || exit 1
9
10 cat <<EOF > fc5.ok
11 #, c-format
12 msgid "father of %d children"
13 msgstr ""
14 EOF
15
16 : ${DIFF=diff}
17 ${DIFF} fc5.ok fc5.pot || exit 1
18
19 # This should better be Farsi, not German. Can some translator help me?
20 cat <<EOF > fa.po
21 #, c-format
22 msgid "father of %d children"
23 msgstr "Vater von %Id Kindern"
24 EOF
25
26 test -d fa || mkdir fa
27 test -d fa/LC_MESSAGES || mkdir fa/LC_MESSAGES
28
29 : ${MSGFMT=msgfmt}
30 ${MSGFMT} -o fa/LC_MESSAGES/fc5.mo fa.po
31
32 : ${MSGUNFMT=msgunfmt}
33 ${MSGUNFMT} -o fa.po.tmp fa/LC_MESSAGES/fc5.mo || exit 1
34 LC_ALL=C tr -d '\r' < fa.po.tmp > fa.po.un || exit 1
35
36 : ${DIFF=diff}
37 ${DIFF} fa.po fa.po.un || exit 1
38
39 LANGUAGE= ../fc5 fa_IR
40 case $? in
41   0) ;;
42   77)
43     if test -f /usr/bin/localedef; then
44       echo "Skipping test: locale fa_IR not installed"
45     else
46       echo "Skipping test: locale fa_IR not supported"
47     fi
48     exit 77;;
49   *) exit 1;;
50 esac
51
52 exit 0