40 $authors = preg_replace(
"#/\* Translators\:\n(.*?)\n \*/(.*)#s",
'$1', $data );
41 if ( $authors === $data ) {
45 static function ( $author ) {
47 return substr( $author, 6 );
49 explode(
"\n", $authors )
58 $dataStart = strpos( $data,
'{' );
59 $dataEnd = strrpos( $data,
'}' );
64 $data = substr( $data, $dataStart + 1, $dataEnd - $dataStart - 1 );
69 $data = preg_replace(
'#^(\s*?)//(.*?)$#m',
'', $data );
74 $data = preg_replace(
"#\'\,\n#",
"\",\n", $data );
79 $data = trim( $data );
88 $data = explode(
"\",\n", $data );
91 foreach ( $data as $segment ) {
100 $segment = preg_replace(
'/"\s*\+\s*"/',
'', $segment );
102 list( $key, $value ) = preg_split(
'/:\s*[\'"]/', $segment, 2 );
107 $key = trim( trim( $key ),
"'\"" );
108 $value = trim( trim( $value ),
"'\"" );
116 $messages = $this->group->getMangler()->mangleArray( $messages );
119 'AUTHORS' => $authors,
120 'MESSAGES' => $messages
131 $mangler = $this->group->getMangler();
138 foreach ( $collection as $message ) {
139 if ( strlen( $message->translation() ) === 0 ) {
143 $key = $mangler->unmangle( $message->key() );
144 $key = $this->
transformKey( self::escapeJsString( $key ) );
148 $body .=
"\t{$key}: \"{$translation}\",\n";
151 if ( strlen( $body ) === 0 ) {
158 $body = substr( $body, 0, -2 );
161 return $header . $body . $this->
footer();