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