• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "$wabs_srcdir"/format-c-4-prg.c || Exit 1
8LC_ALL=C tr -d '\r' < fc4.tmp > fc4.pot || Exit 1
9
10cat <<EOF > fc4.ok
11#, c-format
12msgid "father of %<PRId8> child"
13msgid_plural "father of %<PRId8> children"
14msgstr[0] ""
15msgstr[1] ""
16EOF
17
18: ${DIFF=diff}
19${DIFF} fc4.ok fc4.pot || Exit 1
20
21cat <<EOF > fc4-de.po
22#, c-format
23msgid "father of %<PRId8> child"
24msgid_plural "father of %<PRId8> children"
25msgstr[0] "Vater eines Kindes"
26msgstr[1] "Vater von %<PRId8> Kindern"
27EOF
28
29test -d fc4-dir || mkdir fc4-dir
30test -d fc4-dir/fr || mkdir fc4-dir/fr
31test -d fc4-dir/fr/LC_MESSAGES || mkdir fc4-dir/fr/LC_MESSAGES
32
33: ${MSGFMT=msgfmt}
34${MSGFMT} -o fc4-dir/fr/LC_MESSAGES/fc4.mo fc4-de.po
35
36: ${MSGUNFMT=msgunfmt}
37${MSGUNFMT} -o fc4-de.po.tmp fc4-dir/fr/LC_MESSAGES/fc4.mo || Exit 1
38LC_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
43if test -z "$USE_SYSTEM_LIBINTL"; then
44  # In the tests/ dir: Rely on a fake setlocale, so that we can exercise
45  # the test on all platforms.
46
47  LANGUAGE= ../fc4 fr_FR || Exit 1
48
49else
50  # In the system-tests/ dir: Don't use a fake setlocale.
51
52  : ${LOCALE_FR=fr_FR}
53  : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
54  if test $LOCALE_FR != none; then
55    prepare_locale_ fc4-dir/fr fc4-dir/$LOCALE_FR
56    LANGUAGE= ../fc4 $LOCALE_FR || Exit 1
57  fi
58  if test $LOCALE_FR_UTF8 != none; then
59    prepare_locale_ fc4-dir/fr fc4-dir/$LOCALE_FR_UTF8
60    LANGUAGE= ../fc4 $LOCALE_FR_UTF8 || Exit 1
61  fi
62  if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
63    if test -f /usr/bin/localedef; then
64      echo "Skipping test: no french locale is installed"
65    else
66      echo "Skipping test: no french locale is supported"
67    fi
68    Exit 77
69  fi
70
71fi
72
73Exit 0
74