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