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