Index: trunk/extensions/Translate/MessageCollection.php |
— | — | @@ -196,19 +196,14 @@ |
197 | 197 | |
198 | 198 | if ( $condition === false ) $origKeys = $keys; |
199 | 199 | |
200 | | - $fuzzy = array(); |
201 | 200 | $flipKeys = array_flip( $keys ); |
202 | 201 | foreach ( $this->dbInfo as $row ) { |
203 | 202 | if ( $row->rt_type !== null ) { |
204 | 203 | if ( !isset($flipKeys[$row->page_title]) ) continue; |
205 | 204 | unset($keys[$flipKeys[$row->page_title]]); |
206 | | - $fuzzy[] = $flipKeys[$row->page_title]; |
207 | 205 | } |
208 | 206 | } |
209 | 207 | |
210 | | - if ( !isset($this->tags['fuzzy']) ) |
211 | | - $this->setTags( 'fuzzy', $fuzzy ); |
212 | | - |
213 | 208 | if ( $condition === false ) $keys = array_diff( $origKeys, $keys ); |
214 | 209 | |
215 | 210 | return $keys; |
— | — | @@ -327,9 +322,10 @@ |
328 | 323 | $messages[$key] = new ThinMessage( $key, $this->definitions->messages[$key] ); |
329 | 324 | } |
330 | 325 | |
| 326 | + $flipKeys = array_flip( $this->keys ); |
| 327 | + |
331 | 328 | // Copy rows if any |
332 | 329 | if ( $this->dbData !== null ) { |
333 | | - $flipKeys = array_flip( $this->keys ); |
334 | 330 | foreach ( $this->dbData as $row ) { |
335 | 331 | if ( !isset($flipKeys[$row->page_title]) ) continue; |
336 | 332 | $key = $flipKeys[$row->page_title]; |
— | — | @@ -337,6 +333,15 @@ |
338 | 334 | } |
339 | 335 | } |
340 | 336 | |
| 337 | + if ( $this->dbInfo !== null ) { |
| 338 | + $fuzzy = array(); |
| 339 | + foreach ( $this->dbInfo as $row ) { |
| 340 | + if ( !isset($flipKeys[$row->page_title]) ) continue; |
| 341 | + if ( $row->rt_type !== null ) $fuzzy[] = $flipKeys[$row->page_title]; |
| 342 | + } |
| 343 | + $this->setTags( 'fuzzy', $fuzzy ); |
| 344 | + } |
| 345 | + |
341 | 346 | // Copy tags if any |
342 | 347 | foreach ( $this->tags as $type => $keys ) { |
343 | 348 | foreach( $keys as $key ) { |
Index: trunk/extensions/Translate/tag/RenderJob.php |
— | — | @@ -35,8 +35,9 @@ |
36 | 36 | |
37 | 37 | // Return the actual translation page... |
38 | 38 | $page = TranslatablePage::isTranslationPage( $title ); |
39 | | - if ( $page ) { |
40 | | - var_dump( $params ); |
| 39 | + if ( !$page ) { |
| 40 | + var_dump( $this->params ); |
| 41 | + var_dump( $title ); |
41 | 42 | throw new MWException( "Oops, this should not happen!"); |
42 | 43 | } |
43 | 44 | |
Index: trunk/extensions/Translate/tag/SpecialPageTranslation.php |
— | — | @@ -405,13 +405,14 @@ |
406 | 406 | } |
407 | 407 | |
408 | 408 | public function addFuzzyTags( $page, $changed ) { |
| 409 | + if ( !count($changed) ) return; |
409 | 410 | $titles = array(); |
410 | | - $prefix = $page->getTitle->getPrefixedText(); |
| 411 | + $prefix = $page->getTitle()->getPrefixedText(); |
411 | 412 | $db = wfGetDB( DB_MASTER ); |
412 | 413 | foreach ( $changed as $c ) { |
413 | 414 | $title = Title::makeTitleSafe( NS_TRANSLATIONS, "$prefix/$c" ); |
414 | 415 | if ( $title ) { |
415 | | - $titles[] = 'page_title like \'' . $db->escapeLike( $title->getPrefixedDBkey() ) . '/%\''; |
| 416 | + $titles[] = 'page_title like \'' . $db->escapeLike( $title->getDBkey() ) . '/%\''; |
416 | 417 | } |
417 | 418 | } |
418 | 419 | |
— | — | @@ -432,7 +433,9 @@ |
433 | 434 | 'rt_revision' => $r->page_latest, |
434 | 435 | ); |
435 | 436 | } |
436 | | - $db->replace( 'revtag', array( 'rt_type_page_revision' ), $inserts, __METHOD__ ); |
| 437 | + if ( count($inserts) ) { |
| 438 | + $db->replace( 'revtag', array( 'rt_type_page_revision' ), $inserts, __METHOD__ ); |
| 439 | + } |
437 | 440 | } |
438 | 441 | |
439 | 442 | public function setupRenderJobs( TranslatablePage $page ) { |
Index: trunk/extensions/Translate/tag/TPParse.php |
— | — | @@ -111,6 +111,7 @@ |
112 | 112 | // For finding the messages |
113 | 113 | $prefix = $this->title->getPrefixedDBKey() . '/'; |
114 | 114 | |
| 115 | + $collection->filter( 'hastranslation', false ); |
115 | 116 | $collection->loadTranslations(); |
116 | 117 | |
117 | 118 | foreach ( $this->sections as $ph => $s ) { |
— | — | @@ -129,7 +130,8 @@ |
130 | 131 | foreach ( $vars as $key => $value ) { |
131 | 132 | $sectiontext = str_replace( $key, $value, $sectiontext ); |
132 | 133 | } |
133 | | - if ( $msg->fuzzy() ) { |
| 134 | + |
| 135 | + if ( $msg->hasTag('fuzzy') ) { |
134 | 136 | $sectiontext = "<div class=\"mw-translate-fuzzy\">\n$sectiontext\n</div>"; |
135 | 137 | } |
136 | 138 | $text = str_replace( $ph, $sectiontext, $text ); |
Index: trunk/extensions/Translate/TranslateEditAddons.php |
— | — | @@ -339,6 +339,7 @@ |
340 | 340 | $page = TranslatablePage::newFromTitle( $group->title ); |
341 | 341 | $rev = $page->getTransRev( "$key/$code" ); |
342 | 342 | $latest = $page->getMarkedTag(); |
| 343 | + var_dump( "$rev !== $latest" ); |
343 | 344 | if ( $rev !== $latest ) { |
344 | 345 | $oldpage = TranslatablePage::newFromRevision( $group->title, $rev ); |
345 | 346 | $oldtext = null; |
— | — | @@ -442,9 +443,10 @@ |
443 | 444 | // Check for problems |
444 | 445 | global $wgTranslateDocumentationLanguageCode; |
445 | 446 | if ( !$fuzzy && $code !== $wgTranslateDocumentationLanguageCode ) { |
| 447 | + $en = $group->getMessage( $key, 'en' ); |
446 | 448 | $message = new FatMessage( $key, $en ); |
447 | 449 | // Take the contents from edit field as a translation |
448 | | - $message->setTranslation( $translation ); |
| 450 | + $message->setTranslation( $text ); |
449 | 451 | $checker = MessageChecks::getInstance(); |
450 | 452 | if ( $checker->hasChecks( $group->getType() ) ) { |
451 | 453 | $checks = $checker->doChecks( $message, $group->getType(), $code ); |
Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -176,10 +176,6 @@ |
177 | 177 | $wgTranslatePHPlot = false; |
178 | 178 | $wgTranslatePHPlotFont = '/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf'; |
179 | 179 | |
180 | | - |
181 | | -function wfMemIn() { } |
182 | | -function wfMemOut() { } |
183 | | - |
184 | 180 | function efTranslateInit() { |
185 | 181 | global $wgTranslatePHPlot, $wgAutoloadClasses, $wgHooks; |
186 | 182 | if ( $wgTranslatePHPlot ) { |
— | — | @@ -302,3 +298,8 @@ |
303 | 299 | $parser->setHook( 'languages', array( 'PageTranslationHooks', 'languages' ) ); |
304 | 300 | return true; |
305 | 301 | } |
| 302 | + |
| 303 | +if ( !defined('TRANSLATE_CLI') ) { |
| 304 | + function STDOUT() {} |
| 305 | + function STDERR() {} |
| 306 | +} |
\ No newline at end of file |