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