17 public function getFileExtensions() {
25 public function readFromVariable( $data ) {
28 preg_match_all(
'/^ \* @author\s+(.+)$/m', $data, $matches );
29 $authors = $matches[1];
33 $regex =
'/^\$(.*?)\s*=\s*[\'"](.*?)[\'"];.*?$/mus';
34 preg_match_all( $regex, $data, $matches, PREG_SET_ORDER );
37 foreach ( $matches as $_ ) {
38 $legal = Title::legalChars();
39 $key = preg_replace_callback(
"/([^$legal]|\\\\)/u",
40 static function ( $m ) {
41 return '\x' . dechex( ord( $m[0] ) );
45 $value = str_replace( [
"\'",
"\\\\" ], [
"'",
"\\" ], $_[2] );
46 $messages[$key] = $value;
49 $messages = $this->group->getMangler()->mangleArray( $messages );
52 'AUTHORS' => $authors,
53 'MESSAGES' => $messages,
58 $output = $this->extra[
'header'] ??
"<?php\n";
59 $output .= $this->doHeader( $collection );
61 $mangler = $this->group->getMangler();
64 foreach ( $collection as $item ) {
65 $key = $mangler->unmangle( $item->key() );
66 $key = stripcslashes( $key );
68 $value = $item->translation();
69 if ( $value ===
null ) {
73 $value = str_replace( TRANSLATE_FUZZY,
'', $value );
74 $value = addcslashes( $value,
"'" );
76 $output .=
"\$$key = '$value';\n";
83 global $wgServer, $wgTranslateDocumentationLanguageCode;
85 $code = $collection->code;
89 if ( $wgTranslateDocumentationLanguageCode ) {
90 $docu =
"\n * See the $wgTranslateDocumentationLanguageCode 'language' for " .
91 'message documentation incl. usage of parameters';
96 $authors = $this->doAuthors( $collection );
117 $authors = $this->filterAuthors( $authors, $collection->code );
119 foreach ( $authors as $author ) {
120 $output .=
" * @author $author\n";
126 public static function getExtraSchema() {
Core message collection class.
getAuthors()
Lists all translators that have contributed to the latest revisions of each translation.
static getLanguageName( $code, $language='en')
Returns a localised language name.