Home | History | Annotate | Line # | Download | only in tests
      1 #! /bin/sh
      2 
      3 # Test 'I' format directive flag.
      4 
      5 tmpfiles=""
      6 trap 'rm -fr $tmpfiles' 1 2 3 15
      7 
      8 tmpfiles="$tmpfiles fc5.pot"
      9 : ${XGETTEXT=xgettext}
     10 ${XGETTEXT} -o fc5.pot --omit-header --no-location ${top_srcdir}/tests/format-c-5-prg.c
     11 
     12 tmpfiles="$tmpfiles fc5.ok"
     13 cat <<EOF > fc5.ok
     14 #, c-format
     15 msgid "father of %d children"
     16 msgstr ""
     17 EOF
     18 
     19 : ${DIFF=diff}
     20 ${DIFF} fc5.ok fc5.pot || exit 1
     21 
     22 tmpfiles="$tmpfiles fa.po"
     23 # This should better be Farsi, not German. Can some translator help me?
     24 cat <<EOF > fa.po
     25 #, c-format
     26 msgid "father of %d children"
     27 msgstr "Vater von %Id Kindern"
     28 EOF
     29 
     30 tmpfiles="$tmpfiles fa"
     31 test -d fa || mkdir fa
     32 test -d fa/LC_MESSAGES || mkdir fa/LC_MESSAGES
     33 
     34 : ${MSGFMT=msgfmt}
     35 ${MSGFMT} -o fa/LC_MESSAGES/fc5.mo fa.po
     36 
     37 tmpfiles="$tmpfiles fa.po.tmp"
     38 : ${MSGUNFMT=msgunfmt}
     39 ${MSGUNFMT} -o fa.po.tmp fa/LC_MESSAGES/fc5.mo
     40 
     41 : ${DIFF=diff}
     42 ${DIFF} fa.po fa.po.tmp || exit 1
     43 
     44 LANGUAGE= ./fc5 fa_IR
     45 case $? in
     46   0) ;;
     47   77)
     48     if test -f /usr/bin/localedef; then
     49       echo "Skipping test: locale fa_IR not installed"
     50     else
     51       echo "Skipping test: locale fa_IR not supported"
     52     fi
     53     rm -fr $tmpfiles; exit 77;;
     54   *) exit 1;;
     55 esac
     56 
     57 rm -fr $tmpfiles
     58 
     59 exit 0
     60