Index: trunk/extensions/Translate/tag/TPParse.php |
— | — | @@ -116,14 +116,16 @@ |
117 | 117 | return $text; |
118 | 118 | } |
119 | 119 | |
120 | | - public function getTranslationPageText( MessageCollection $collection ) { |
| 120 | + public function getTranslationPageText( /*MessageCollection*/ $collection ) { |
121 | 121 | $text = $this->template; // The source |
122 | 122 | |
123 | 123 | // For finding the messages |
124 | 124 | $prefix = $this->title->getPrefixedDBKey() . '/'; |
125 | 125 | |
126 | | - $collection->filter( 'hastranslation', false ); |
127 | | - $collection->loadTranslations(); |
| 126 | + if ( $collection instanceOf MessageCollection ) { |
| 127 | + $collection->filter( 'hastranslation', false ); |
| 128 | + $collection->loadTranslations(); |
| 129 | + } |
128 | 130 | |
129 | 131 | foreach ( $this->sections as $ph => $s ) { |
130 | 132 | $sectiontext = null; |
Index: trunk/extensions/Translate/tag/PageTranslationHooks.php |
— | — | @@ -8,14 +8,8 @@ |
9 | 9 | $title = $parser->getTitle(); |
10 | 10 | |
11 | 11 | if ( strpos( $text, '<translate>' ) !== false ) { |
12 | | - $nowiki = array(); |
13 | | - $text = TranslatablePage::armourNowiki( $nowiki, $text ); |
14 | | - $cb = array( __CLASS__, 'replaceTagCb' ); |
15 | | - # Remove the tags nicely, trying to not leave excess whitespace lying around |
16 | | - $text = preg_replace_callback( '~(<translate>\n??)(.*)(\n??</translate>)~sU', $cb, $text ); |
17 | | - # Replace variable markers |
18 | | - $text = preg_replace_callback( '~(<tvar[^<>]+>)(.*)(</>)~s', $cb, $text ); |
19 | | - $text = TranslatablePage::unArmourNowiki( $nowiki, $text ); |
| 12 | + $parse = TranslatablePage::newFromText( $parser->getTitle(), $text )->getParse(); |
| 13 | + $text = $parse->getTranslationPageText( null ); |
20 | 14 | } |
21 | 15 | |
22 | 16 | // For translation pages, parse plural, grammar etc with correct language |