mirror of
https://https.git.savannah.gnu.org/git/gettext.git
synced 2026-01-27 01:44:30 +00:00
* gettext-tools/src/format-php.c (struct spec): Add field 'likely_intentional_directives'. (format_parse): Set it to the number of directives that don't contain a space. (format_is_unlikely_intentional): New function. (formatstring_php): Use it. * gettext-tools/tests/format-php-3: New file. * gettext-tools/tests/Makefile.am (TESTS): Add it.
50 lines
1.1 KiB
Bash
Executable File
50 lines
1.1 KiB
Bash
Executable File
#! /bin/sh
|
|
. "${srcdir=.}/init.sh"; path_prepend_ . ../src
|
|
|
|
# Test heuristic recognition of PHP format strings like "100% complete".
|
|
|
|
cat <<\EOF > f-ph-3.php
|
|
<?php
|
|
gettext("Test 1a is 100% complete")
|
|
printf(gettext("Test 1b is 100% complete"), 120)
|
|
gettext("Test 2a from 0% complete to 100% complete")
|
|
printf(gettext("Test 2b from 0% complete to 100% complete"), 120, 121)
|
|
gettext("Test 3a of %s is 100% complete")
|
|
printf(gettext("Test 3b of %s is 100% complete"), "foo", 120)
|
|
?>
|
|
EOF
|
|
|
|
: ${XGETTEXT=xgettext}
|
|
${XGETTEXT} --omit-header --no-location -d f-ph-3.tmp f-ph-3.php || Exit 1
|
|
LC_ALL=C tr -d '\r' < f-ph-3.tmp.po > f-ph-3.po || Exit 1
|
|
|
|
cat <<\EOF > f-ph-3.ok
|
|
msgid "Test 1a is 100% complete"
|
|
msgstr ""
|
|
|
|
#, php-format
|
|
msgid "Test 1b is 100% complete"
|
|
msgstr ""
|
|
|
|
msgid "Test 2a from 0% complete to 100% complete"
|
|
msgstr ""
|
|
|
|
#, php-format
|
|
msgid "Test 2b from 0% complete to 100% complete"
|
|
msgstr ""
|
|
|
|
#, php-format
|
|
msgid "Test 3a of %s is 100% complete"
|
|
msgstr ""
|
|
|
|
#, php-format
|
|
msgid "Test 3b of %s is 100% complete"
|
|
msgstr ""
|
|
EOF
|
|
|
|
: ${DIFF=diff}
|
|
${DIFF} f-ph-3.ok f-ph-3.po
|
|
result=$?
|
|
|
|
exit $result
|