group->getMangler()->mangle( $messages ); return [ 'AUTHORS' => $authors, 'MESSAGES' => $messages, ]; } protected function writeReal( MessageCollection $collection ) { if ( isset( $this->extra['header'] ) ) { $output = $this->extra['header']; } else { $output = "doHeader( $collection ); $mangler = $this->group->getMangler(); /** * @var TMessage $item */ foreach ( $collection as $item ) { $key = $mangler->unmangle( $item->key() ); $key = stripcslashes( $key ); $value = $item->translation(); if ( $value === null ) { continue; } $value = str_replace( TRANSLATE_FUZZY, '', $value ); $value = addcslashes( $value, "'" ); $output .= "\$$key = '$value';\n"; } return $output; } protected function doHeader( MessageCollection $collection ) { global $wgSitename, $wgTranslateDocumentationLanguageCode; $code = $collection->code; $name = TranslateUtils::getLanguageName( $code ); $native = TranslateUtils::getLanguageName( $code, $code ); if ( $wgTranslateDocumentationLanguageCode ) { $docu = "\n * See the $wgTranslateDocumentationLanguageCode 'language' for " . 'message documentation incl. usage of parameters'; } else { $docu = ''; } $authors = $this->doAuthors( $collection ); $output = <<getAuthors(); $authors = $this->filterAuthors( $authors, $collection->code ); foreach ( $authors as $author ) { $output .= " * @author $author\n"; } return $output; } public static function getExtraSchema() { $schema = [ 'root' => [ '_type' => 'array', '_children' => [ 'FILES' => [ '_type' => 'array', '_children' => [ 'header' => [ '_type' => 'text', ], ] ] ] ] ]; return $schema; } }