42 $authors = preg_replace(
"#/\* Translators\:\n(.*?)\n \*/(.*)#s",
'$1', $data );
43 if ( $authors === $data ) {
47 static function ( $author ) {
49 return substr( $author, 6 );
51 explode(
"\n", $authors )
60 $dataStart = strpos( $data,
'{' );
61 $dataEnd = strrpos( $data,
'}' );
66 $data = substr( $data, $dataStart + 1, $dataEnd - $dataStart - 1 );
71 $data = preg_replace(
'#^(\s*?)//(.*?)$#m',
'', $data );
76 $data = preg_replace(
"#\'\,\n#",
"\",\n", $data );
81 $data = trim( $data );
90 $data = explode(
"\",\n", $data );
93 foreach ( $data as $segment ) {
102 $segment = preg_replace(
'/"\s*\+\s*"/',
'', $segment );
104 list( $key, $value ) = preg_split(
'/:\s*[\'"]/', $segment, 2 );
109 $key = trim( trim( $key ),
"'\"" );
110 $value = trim( trim( $value ),
"'\"" );
118 $messages = $this->group->getMangler()->mangleArray( $messages );
121 'AUTHORS' => $authors,
122 'MESSAGES' => $messages
133 $mangler = $this->group->getMangler();
140 foreach ( $collection as $message ) {
141 if ( strlen( $message->translation() ) === 0 ) {
145 $key = $mangler->unmangle( $message->key() );
146 $key = $this->
transformKey( self::escapeJsString( $key ) );
150 $body .=
"\t{$key}: \"{$translation}\",\n";
153 if ( strlen( $body ) === 0 ) {
160 $body = substr( $body, 0, -2 );
163 return $header . $body . $this->
footer();