i18n tools: In StringExtractor
don't strip slashes from URLs.
Props SergeyBiryukov, ocean90. Fixes #36015. git-svn-id: https://develop.svn.wordpress.org/trunk@36781 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
5f808bd8fc
commit
f8af8cdc6c
@ -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;
|
||||
}
|
||||
|
@ -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( '__' ),
|
||||
"<?php
|
||||
// translators: let your ears fly!
|
||||
__( 'on' );"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group comment
|
||||
*/
|
||||
function test_find_function_calls_with_url_in_comment() {
|
||||
$this->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( '__' ),
|
||||
"<?php
|
||||
/* translators: localized date and time format, see http://php.net/date */
|
||||
__( 'F j, Y g:i a' );"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group comment
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user