Home | History | Annotate | Line # | Download | only in tests
      1 #! /bin/sh
      2 
      3 # Test plural count for locales with nplurals != 2.
      4 
      5 tmpfiles=""
      6 trap 'rm -fr $tmpfiles' 1 2 3 15
      7 
      8 tmpfiles="$tmpfiles mi-test1.pot"
      9 cat <<\EOF > mi-test1.pot
     10 # SOME DESCRIPTIVE TITLE.
     11 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
     12 # This file is distributed under the same license as the PACKAGE package.
     13 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
     14 #
     15 #, fuzzy
     16 msgid ""
     17 msgstr ""
     18 "Project-Id-Version: PACKAGE VERSION\n"
     19 "Report-Msgid-Bugs-To: \n"
     20 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
     21 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     22 "Language-Team: LANGUAGE <LL (at] li.org>\n"
     23 "MIME-Version: 1.0\n"
     24 "Content-Type: text/plain; charset=CHARSET\n"
     25 "Content-Transfer-Encoding: 8bit\n"
     26 
     27 #, c-format
     28 msgid "'Your command, please?', asked the waiter."
     29 msgstr ""
     30 
     31 #, c-format
     32 msgid "a piece of cake"
     33 msgid_plural "%d pieces of cake"
     34 msgstr[0] ""
     35 msgstr[1] ""
     36 
     37 #, c-format
     38 msgid "%s is replaced by %s."
     39 msgstr ""
     40 EOF
     41 
     42 tmpfiles="$tmpfiles mi-test1.tmp mi-test1.out mi-test1.err"
     43 : ${MSGINIT=msginit}
     44 ${MSGINIT} -i mi-test1.pot -l ga_IE --no-translator -o mi-test1.tmp 2>mi-test1.err
     45 test $? = 0 || { cat mi-test1.err 1>&2; rm -fr $tmpfiles; exit 1; }
     46 sed -e '1,15d' < mi-test1.tmp > mi-test1.out
     47 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
     48 
     49 tmpfiles="$tmpfiles mi-test1.ok"
     50 cat <<\EOF > mi-test1.ok
     51 "Plural-Forms: nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2;\n"
     52 
     53 #, c-format
     54 msgid "'Your command, please?', asked the waiter."
     55 msgstr ""
     56 
     57 #, c-format
     58 msgid "a piece of cake"
     59 msgid_plural "%d pieces of cake"
     60 msgstr[0] ""
     61 msgstr[1] ""
     62 msgstr[2] ""
     63 
     64 #, c-format
     65 msgid "%s is replaced by %s."
     66 msgstr ""
     67 EOF
     68 
     69 : ${DIFF=diff}
     70 ${DIFF} mi-test1.ok mi-test1.out
     71 result=$?
     72 
     73 rm -fr $tmpfiles
     74 
     75 exit $result
     76