r111362 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111361‎ | r111362 | r111363 >
Date:12:45, 13 February 2012
Author:nikerabbit
Status:ok
Tags:i18nreview 
Comment:
Made suggestions task use TTMServer
Modified paths:
  • /trunk/extensions/Translate/TranslateTasks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/TranslateTasks.php
@@ -284,25 +284,18 @@
285285
286286 foreach ( $this->collection->getMessageKeys() as $key ) {
287287 // Allow up to 10 seconds to search for suggestions.
288 - if ( time() - $start > 10 || TranslationHelpers::checkTranslationServiceFailure( 'tmserver' ) ) {
 288+ if ( time() - $start > 10 ) {
289289 unset( $this->collection[$key] );
290290 continue;
291291 }
292292
293 - $def = rawurlencode( $this->collection[$key]->definition() );
294 - $url = "$server:$port/tmserver/$sourceLanguage/$code/unit/$def";
295 - $suggestions = Http::get( $url, $timeout );
296 -
297 - if ( $suggestions !== false ) {
298 - $suggestions = FormatJson::decode( $suggestions, true );
299 - foreach ( $suggestions as $s ) {
300 - // We have a good suggestion, do not filter.
301 - if ( $s['quality'] > 0.80 ) {
302 - continue 2;
303 - }
 293+ $definition = $this->collection[$key]->definition();
 294+ $suggestions = TTMServer::primary()->query( $sourceLanguage, $code, $definition );
 295+ foreach ( $suggestions as $s ) {
 296+ // We have a good suggestion, do not filter.
 297+ if ( $s['quality'] > 0.80 ) {
 298+ continue 2;
304299 }
305 - } else {
306 - TranslationHelpers::reportTranslationServiceFailure( 'tmserver' );
307300 }
308301 unset( $this->collection[$key] );
309302 }

Sign-offs

UserFlagDate
Awjrichardsinspected22:54, 17 February 2012

Follow-up revisions

RevisionCommit summaryAuthorDate
r111395Ping r111362 - remove rest of unneeded codenikerabbit17:40, 13 February 2012

Status & tagging log