Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-python-2
1 #!/bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test Python support: --add-comments option.
5
6 cat <<EOF > xg-py-2.py
7 # This comment will not be extracted.
8 print gettext.gettext("help")
9 #  TRANSLATORS: This is an extracted comment.
10 print gettext.gettext("me")
11 # Not extracted either.
12 print gettext.gettext("Hey Jude")
13 # TRANSLATORS:
14 #    Nickname of the Beatles
15 print gettext.gettext("The Fabulous Four")
16 # TRANSLATORS: The strings get concatenated.
17 print gettext.gettext("there is not enough"
18 " room on a single line for this entire long, " # confusing, eh?
19 "verbose string")
20 EOF
21
22 : ${XGETTEXT=xgettext}
23 ${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
24   -d xg-py-2.tmp xg-py-2.py || exit 1
25 LC_ALL=C tr -d '\r' < xg-py-2.tmp.po > xg-py-2.po || exit 1
26
27 cat <<EOF > xg-py-2.ok
28 msgid "help"
29 msgstr ""
30
31 #. TRANSLATORS: This is an extracted comment.
32 msgid "me"
33 msgstr ""
34
35 msgid "Hey Jude"
36 msgstr ""
37
38 #. TRANSLATORS:
39 #. Nickname of the Beatles
40 msgid "The Fabulous Four"
41 msgstr ""
42
43 #. TRANSLATORS: The strings get concatenated.
44 msgid ""
45 "there is not enough room on a single line for this entire long, verbose "
46 "string"
47 msgstr ""
48 EOF
49
50 : ${DIFF=diff}
51 ${DIFF} xg-py-2.ok xg-py-2.po
52 result=$?
53
54 exit $result