Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / format-c-4
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test ISO C 99 <inttypes.h> format string directives with plural forms.
5
6 : ${XGETTEXT=xgettext}
7 ${XGETTEXT} -o fc4.tmp --omit-header --no-location "$abs_srcdir"/format-c-4-prg.c || exit 1
8 LC_ALL=C tr -d '\r' < fc4.tmp > fc4.pot || exit 1
9
10 cat <<EOF > fc4.ok
11 #, c-format
12 msgid "father of %<PRId8> child"
13 msgid_plural "father of %<PRId8> children"
14 msgstr[0] ""
15 msgstr[1] ""
16 EOF
17
18 : ${DIFF=diff}
19 ${DIFF} fc4.ok fc4.pot || exit 1
20
21 cat <<EOF > fc4-de.po
22 #, c-format
23 msgid "father of %<PRId8> child"
24 msgid_plural "father of %<PRId8> children"
25 msgstr[0] "Vater eines Kindes"
26 msgstr[1] "Vater von %<PRId8> Kindern"
27 EOF
28
29 test -d fc4-dir || mkdir fc4-dir
30 test -d fc4-dir/de || mkdir fc4-dir/de
31 test -d fc4-dir/de/LC_MESSAGES || mkdir fc4-dir/de/LC_MESSAGES
32
33 : ${MSGFMT=msgfmt}
34 ${MSGFMT} -o fc4-dir/de/LC_MESSAGES/fc4.mo fc4-de.po
35
36 : ${MSGUNFMT=msgunfmt}
37 ${MSGUNFMT} -o fc4-de.po.tmp fc4-dir/de/LC_MESSAGES/fc4.mo || exit 1
38 LC_ALL=C tr -d '\r' < fc4-de.po.tmp > fc4-de.po.un || exit 1
39
40 : ${DIFF=diff}
41 ${DIFF} fc4-de.po fc4-de.po.un || exit 1
42
43 LANGUAGE= ../fc4 de_DE
44 result=$?
45
46 exit $result