Home | History | Annotate | Line # | Download | only in tests
      1 #!/bin/sh
      2 
      3 # Test Perl support: --add-comments option.
      4 
      5 tmpfiles=""
      6 trap 'rm -fr $tmpfiles' 1 2 3 15
      7 
      8 tmpfiles="$tmpfiles xg-pl-5.pl"
      9 cat <<EOF > xg-pl-5.pl
     10 # This comment will not be extracted.
     11 print gettext "help";
     12 #  TRANSLATORS: This is an extracted comment.
     13 print gettext "me";
     14 # Not extracted either.
     15 print gettext "Hey Jude";
     16 # TRANSLATORS:
     17 #    Nickname of the Beatles
     18 print gettext "The Fabulous Four";
     19 EOF
     20 
     21 tmpfiles="$tmpfiles xg-pl-5.po"
     22 : ${XGETTEXT=xgettext}
     23 ${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
     24   -d xg-pl-5 xg-pl-5.pl
     25 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
     26 
     27 tmpfiles="$tmpfiles xg-pl-5.ok"
     28 cat <<EOF > xg-pl-5.ok
     29 msgid "help"
     30 msgstr ""
     31 
     32 #. TRANSLATORS: This is an extracted comment.
     33 msgid "me"
     34 msgstr ""
     35 
     36 msgid "Hey Jude"
     37 msgstr ""
     38 
     39 #. TRANSLATORS:
     40 #. Nickname of the Beatles
     41 msgid "The Fabulous Four"
     42 msgstr ""
     43 EOF
     44 
     45 : ${DIFF=diff}
     46 ${DIFF} xg-pl-5.ok xg-pl-5.po
     47 result=$?
     48 
     49 rm -fr $tmpfiles
     50 
     51 exit $result
     52