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