diff --git a/tools/i18n/extract.php b/tools/i18n/extract.php index db0c8b4916..023b28bc69 100644 --- a/tools/i18n/extract.php +++ b/tools/i18n/extract.php @@ -172,7 +172,7 @@ class StringExtractor { if ( T_COMMENT == $id ) { $text = preg_replace( '%^\s+\*\s%m', '', $text ); $text = str_replace( array( "\r\n", "\n" ), ' ', $text );; - $text = trim( preg_replace( '%^/\*|//%', '', preg_replace( '%\*/$%', '', $text ) ) ); + $text = trim( preg_replace( '%^(/\*|//)%', '', preg_replace( '%\*/$%', '', $text ) ) ); if ( 0 === stripos( $text, $this->comment_prefix ) ) { $latest_comment = $text; } diff --git a/tools/i18n/t/ExtractTest.php b/tools/i18n/t/ExtractTest.php index 25ae44098c..8a38f5c583 100644 --- a/tools/i18n/t/ExtractTest.php +++ b/tools/i18n/t/ExtractTest.php @@ -183,6 +183,38 @@ class ExtractTest extends PHPUnit_Framework_TestCase { ); } + /** + * @group comment + */ + function test_find_function_calls_with_c_style_comment() { + $this->assertEquals( array( array( + 'name' => '__', 'args' => array( 'on' ), 'line' => 3, + 'comment' => 'translators: let your ears fly!' + ) ), + $this->extractor->find_function_calls( array( '__' ), + "assertEquals( array( array( + 'name' => '__', 'args' => array( 'F j, Y g:i a' ), 'line' => 3, + 'comment' => 'translators: localized date and time format, see http://php.net/date' + ) ), + $this->extractor->find_function_calls( array( '__' ), + "