Home | History | Annotate | Line # | Download | only in tests
      1  1.1  christos #!/bin/sh
      2  1.1  christos 
      3  1.1  christos # Test Python support: --add-comments option.
      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 xg-py-2.py"
      9  1.1  christos cat <<EOF > xg-py-2.py
     10  1.1  christos # This comment will not be extracted.
     11  1.1  christos print gettext.gettext("help")
     12  1.1  christos #  TRANSLATORS: This is an extracted comment.
     13  1.1  christos print gettext.gettext("me")
     14  1.1  christos # Not extracted either.
     15  1.1  christos print gettext.gettext("Hey Jude")
     16  1.1  christos # TRANSLATORS:
     17  1.1  christos #    Nickname of the Beatles
     18  1.1  christos print gettext.gettext("The Fabulous Four")
     19  1.1  christos # TRANSLATORS: The strings get concatenated.
     20  1.1  christos print gettext.gettext("there is not enough"
     21  1.1  christos " room on a single line for this entire long, " # confusing, eh?
     22  1.1  christos "verbose string")
     23  1.1  christos EOF
     24  1.1  christos 
     25  1.1  christos tmpfiles="$tmpfiles xg-py-2.po"
     26  1.1  christos : ${XGETTEXT=xgettext}
     27  1.1  christos ${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
     28  1.1  christos   -d xg-py-2 xg-py-2.py
     29  1.1  christos test $? = 0 || { rm -fr $tmpfiles; exit 1; }
     30  1.1  christos 
     31  1.1  christos tmpfiles="$tmpfiles xg-py-2.ok"
     32  1.1  christos cat <<EOF > xg-py-2.ok
     33  1.1  christos msgid "help"
     34  1.1  christos msgstr ""
     35  1.1  christos 
     36  1.1  christos #. TRANSLATORS: This is an extracted comment.
     37  1.1  christos msgid "me"
     38  1.1  christos msgstr ""
     39  1.1  christos 
     40  1.1  christos msgid "Hey Jude"
     41  1.1  christos msgstr ""
     42  1.1  christos 
     43  1.1  christos #. TRANSLATORS:
     44  1.1  christos #. Nickname of the Beatles
     45  1.1  christos msgid "The Fabulous Four"
     46  1.1  christos msgstr ""
     47  1.1  christos 
     48  1.1  christos #. TRANSLATORS: The strings get concatenated.
     49  1.1  christos msgid ""
     50  1.1  christos "there is not enough room on a single line for this entire long, verbose "
     51  1.1  christos "string"
     52  1.1  christos msgstr ""
     53  1.1  christos EOF
     54  1.1  christos 
     55  1.1  christos : ${DIFF=diff}
     56  1.1  christos ${DIFF} xg-py-2.ok xg-py-2.po
     57  1.1  christos result=$?
     58  1.1  christos 
     59  1.1  christos rm -fr $tmpfiles
     60  1.1  christos 
     61  1.1  christos exit $result
     62