xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/tests/xgettext-php-1 (revision 181254a7b1bdde6873432bffef2d2decc4b5c22f)
1#!/bin/sh
2
3# Test PHP support: --add-comments option.
4
5tmpfiles=""
6trap 'rm -fr $tmpfiles' 1 2 3 15
7
8tmpfiles="$tmpfiles xg-ph-1.php"
9cat <<EOF > xg-ph-1.php
10<?
11// This comment will not be extracted.
12echo _("help");
13//  TRANSLATORS: This is an extracted comment.
14echo _("me");
15# TRANSLATORS: This is extracted too.
16echo _("and you");
17/* Not extracted either. */
18echo _("Hey Jude");
19/*  TRANSLATORS:
20     Nickname of the Beatles
21*/
22echo _("The Fabulous Four");
23?>
24EOF
25
26tmpfiles="$tmpfiles xg-ph-1.po"
27: ${XGETTEXT=xgettext}
28${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
29  -d xg-ph-1 xg-ph-1.php
30test $? = 0 || { rm -fr $tmpfiles; exit 1; }
31
32tmpfiles="$tmpfiles xg-ph-1.ok"
33cat <<EOF > xg-ph-1.ok
34msgid "help"
35msgstr ""
36
37#. TRANSLATORS: This is an extracted comment.
38msgid "me"
39msgstr ""
40
41#. TRANSLATORS: This is extracted too.
42msgid "and you"
43msgstr ""
44
45msgid "Hey Jude"
46msgstr ""
47
48#. TRANSLATORS:
49#. Nickname of the Beatles
50#.
51msgid "The Fabulous Four"
52msgstr ""
53EOF
54
55: ${DIFF=diff}
56${DIFF} xg-ph-1.ok xg-ph-1.po
57result=$?
58
59rm -fr $tmpfiles
60
61exit $result
62