Imported Upstream version 0.18.1.1
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-tcl-2
1 #!/bin/sh
2
3 # Test Tcl support: --add-comments option.
4
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
7
8 tmpfiles="$tmpfiles xg-t-2.tcl"
9 cat <<EOF > xg-t-2.tcl
10 # This comment will not be extracted.
11 puts [_ "help"]
12 #  TRANSLATORS: This is an extracted comment.
13 puts [_ "me"]
14 # Not extracted either.
15 puts [_ "Hey Jude"]
16 # TRANSLATORS:
17 #    Nickname of the Beatles
18 puts [_ "The Fabulous Four"]
19 EOF
20
21 tmpfiles="$tmpfiles xg-t-2.tmp.po xg-t-2.po"
22 : ${XGETTEXT=xgettext}
23 ${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: -k_ \
24   -d xg-t-2.tmp xg-t-2.tcl
25 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
26 LC_ALL=C tr -d '\r' < xg-t-2.tmp.po > xg-t-2.po
27 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
28
29 tmpfiles="$tmpfiles xg-t-2.ok"
30 cat <<EOF > xg-t-2.ok
31 msgid "help"
32 msgstr ""
33
34 #. TRANSLATORS: This is an extracted comment.
35 msgid "me"
36 msgstr ""
37
38 msgid "Hey Jude"
39 msgstr ""
40
41 #. TRANSLATORS:
42 #. Nickname of the Beatles
43 msgid "The Fabulous Four"
44 msgstr ""
45 EOF
46
47 : ${DIFF=diff}
48 ${DIFF} xg-t-2.ok xg-t-2.po
49 result=$?
50
51 rm -fr $tmpfiles
52
53 exit $result