mirror of
https://github.com/php-win-ext/gettext.git
synced 2026-04-26 10:18:02 +02:00
45 lines
792 B
Bash
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
|