• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "$wabs_srcdir"/format-c-5-prg.c || Exit 1
8LC_ALL=C tr -d '\r' < fc5.tmp > fc5.pot || Exit 1
9
10cat <<EOF > fc5.ok
11#, c-format
12msgid "father of %d children"
13msgstr ""
14EOF
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?
20cat <<EOF > fa.po
21#, c-format
22msgid "father of %d children"
23msgstr "Vater von %Id Kindern"
24EOF
25
26test -d fa || mkdir fa
27test -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
34LC_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
39if test -z "$USE_SYSTEM_LIBINTL"; then
40  # In the tests/ dir: Rely on a fake setlocale, so that we can exercise
41  # the test on all platforms.
42
43  LANGUAGE= ../fc5 fa_IR
44  case $? in
45    0) ;;
46    77)
47      if test -f /usr/bin/localedef; then
48        echo "Skipping test: locale fa_IR not installed"
49      else
50        echo "Skipping test: locale fa_IR not supported"
51      fi
52      Exit 77;;
53    *) Exit 1;;
54  esac
55
56else
57  # In the system-tests/ dir: Don't use a fake setlocale.
58
59  skipped=true
60
61  prepare_locale_ fa fa_IR
62  LANGUAGE= ../fc5 fa_IR
63  case $? in
64    0) skipped=false ;;
65    77) ;;
66    *) Exit 1;;
67  esac
68
69  prepare_locale_ fa fa_IR.UTF-8
70  LANGUAGE= ../fc5 fa_IR.UTF-8
71  case $? in
72    0) skipped=false ;;
73    77) ;;
74    *) Exit 1;;
75  esac
76
77  if $skipped; then
78    if test -f /usr/bin/localedef; then
79      echo "Skipping test: no Farsi locale is installed"
80    else
81      echo "Skipping test: no Farsi locale is supported"
82    fi
83    Exit 77
84  fi
85
86fi
87
88Exit 0
89