diff --git a/tools/i18n/extract.php b/tools/i18n/extract.php index 59f873a3fd..db0c8b4916 100644 --- a/tools/i18n/extract.php +++ b/tools/i18n/extract.php @@ -170,6 +170,8 @@ class StringExtractor { continue; } 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 ) ) ); 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 32f62797e0..25ae44098c 100644 --- a/tools/i18n/t/ExtractTest.php +++ b/tools/i18n/t/ExtractTest.php @@ -134,27 +134,62 @@ class ExtractTest extends PHPUnit_Framework_TestCase { $this->assertEquals( array( array( 'name' => 'f', 'args' => array( null, "baba" ), 'line' => 1 ) ), $this->extractor->find_function_calls( array('f'), 'assertEquals( array( array( 'name' => 'f', 'args' => array( 'baba' ), 'line' => 1, 'comment' => 'translators: let your ears fly!' ) ), - $this->extractor->find_function_calls( array('f'), 'extractor->find_function_calls( array('f'), 'assertEquals( array( array( 'name' => 'f', 'args' => array( 'baba' ), 'line' => 1, 'comment' => 'translators: let your ears fly!' ) ), - $this->extractor->find_function_calls( array('f'), 'extractor->find_function_calls( array('f'), 'assertEquals( array( array( 'name' => 'f', 'args' => array( 'baba' ), 'line' => 1, 'comment' => 'translators: let your ears fly!' ) ), - $this->extractor->find_function_calls( array('f'), 'extractor->find_function_calls( array('f'), 'assertEquals( array( array( + 'name' => '__', 'args' => array( 'on' ), 'line' => 6, + 'comment' => "Translators: If there are characters in your language that are not supported by Lato, translate this to 'off'. Do not translate into your own language." + ) ), + $this->extractor->find_function_calls( array( '__' ), + "assertEquals( array( array( 'name' => 'f', 'args' => array( 'baba' ), 'line' => 1, 'comment' => 'Translators: let your ears fly!' ) ), - $this->extractor->find_function_calls( array('f'), 'extractor->find_function_calls( array('f'), '