Files
2014-02-13 05:17:49 -08:00

45 lines
792 B
Bash

#!/bin/sh
# Test PHP support: --add-comments option.
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
tmpfiles="$tmpfiles xg-ph-3.php"
cat <<\EOF > xg-ph-3.php
<?
/* a */
/* b */ string = /* c */
/* d */
/* e */ _( /* f */ "hello " /* g */ . /* h */ "world" /* i */ );
?>
EOF
tmpfiles="$tmpfiles xg-ph-3.tmp.po xg-ph-3.po"
: ${XGETTEXT=xgettext}
${XGETTEXT} --add-comments --omit-header --no-location --keyword=_ \
-d xg-ph-3.tmp xg-ph-3.php
test $? = 0 || { rm -fr $tmpfiles; exit 1; }
LC_ALL=C tr -d '\r' < xg-ph-3.tmp.po > xg-ph-3.po
test $? = 0 || { rm -fr $tmpfiles; exit 1; }
tmpfiles="$tmpfiles xg-ph-3.ok"
cat <<EOF > xg-ph-3.ok
#. a
#. b
#. c
#. d
#. e
#. f
msgid "hello world"
msgstr ""
EOF
: ${DIFF=diff}
${DIFF} xg-ph-3.ok xg-ph-3.po
result=$?
rm -fr $tmpfiles
exit $result