Make WordPress Core

Ticket #30972: 30972.patch

File 30972.patch, 1.8 KB (added by SergeyBiryukov, 10 years ago)
  • tools/i18n/extract.php

     
    170170                                continue;
    171171                        }
    172172                        if ( T_COMMENT == $id ) {
     173                                $text = preg_replace( '%^\s+\*\s%m', '', $text );
     174                                $text = str_replace( array( "\r\n", "\n" ), ' ', $text );;
    173175                                $text = trim( preg_replace( '%^/\*|//%', '', preg_replace( '%\*/$%', '', $text ) ) );
    174176                                if ( 0 === stripos( $text, $this->comment_prefix ) ) {
    175177                                        $latest_comment = $text;
  • tools/i18n/t/ExtractTest.php

     
    152152                        $this->extractor->find_function_calls( array('f'), '<?php /* translators: boo */ /* translators: let your ears fly! */ /* baba */ $foo = g ( f( "baba" ) ); ' ) );
    153153        }
    154154
     155        function test_find_function_calls_with_multi_line_comment() {
     156                $this->assertEquals( array( array(
     157                                'name' => 'f', 'args' => array( 'baba' ), 'line' => 6,
     158                                '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."
     159                        ) ),
     160                        $this->extractor->find_function_calls( array('f'),
     161                                "<?php
     162                                /*
     163                                 * Translators: If there are characters in your language that are not supported
     164                                 * by Lato, translate this to 'off'. Do not translate into your own language.
     165                                 */
     166                                f( 'baba' );"
     167                        )
     168                );
     169        }
     170
    155171        function test_comment_prefix_should_be_case_insensitive() {
    156172                $this->assertEquals(
    157173                        array( array( 'name' => 'f', 'args' => array( 'baba' ), 'line' => 1, 'comment' => 'Translators: let your ears fly!' ) ),