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