r71334 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71333‎ | r71334 | r71335 >
Date:07:07, 20 August 2010
Author:siebrand
Status:deferred
Tags:
Comment:
Documentation update.
Modified paths:
  • /trunk/extensions/Translate/MessageChecks.php (modified) (history)
  • /trunk/extensions/Translate/MessageCollection.php (modified) (history)
  • /trunk/extensions/Translate/MessageGroups.php (modified) (history)
  • /trunk/extensions/Translate/SpecialFirstSteps.php (modified) (history)
  • /trunk/extensions/Translate/SpecialImportTranslations.php (modified) (history)
  • /trunk/extensions/Translate/SpecialLanguageStats.php (modified) (history)
  • /trunk/extensions/Translate/SpecialMagic.php (modified) (history)
  • /trunk/extensions/Translate/SpecialSupportedLanguages.php (modified) (history)
  • /trunk/extensions/Translate/SpecialTranslationStats.php (modified) (history)
  • /trunk/extensions/Translate/SpecialTranslations.php (modified) (history)
  • /trunk/extensions/Translate/Translate.alias.php (modified) (history)
  • /trunk/extensions/Translate/Translate.i18n.php (modified) (history)
  • /trunk/extensions/Translate/Translate.php (modified) (history)
  • /trunk/extensions/Translate/TranslateEditAddons.php (modified) (history)
  • /trunk/extensions/Translate/TranslatePage.php (modified) (history)
  • /trunk/extensions/Translate/TranslateTasks.php (modified) (history)
  • /trunk/extensions/Translate/TranslateUtils.php (modified) (history)
  • /trunk/extensions/Translate/check-blacklist.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/TranslatePage.php
@@ -78,7 +78,9 @@
7979 $this->options['group'] = $this->defaults['group'];
8080 }
8181
82 - // Show errors nicely
 82+ /**
 83+ * Show errors nicely.
 84+ */
8385 $wgOut->addHTML( $this->settingsForm( $errors ) );
8486
8587 if ( count( $errors ) ) {
@@ -99,7 +101,9 @@
100102 }
101103 }
102104
103 - # Proceed
 105+ /**
 106+ * Proceed.
 107+ */
104108 $taskOptions = new TaskOptions(
105109 $this->options['language'],
106110 $this->options['limit'],
@@ -107,7 +111,9 @@
108112 array( $this, 'cbAddPagingNumbers' )
109113 );
110114
111 - // Initialise and get output
 115+ /**
 116+ * Initialise and get output.
 117+ */
112118 $this->task->init( $this->group, $taskOptions );
113119 $output = $this->task->execute();
114120
@@ -251,7 +257,9 @@
252258 protected function taskSelector( $pageTranslation = false ) {
253259 $selector = new HTMLSelector( 'task', 'task', $this->options['task'] );
254260
255 - // Check if this is a page translation group to return only appropriate tasks.
 261+ /**
 262+ * Check if this is a page translation group to return only appropriate tasks.
 263+ */
256264 $isPageTranslation = false;
257265 if ( $this->group ) {
258266 $isPageTranslation = strpos( $this->group->getId(), 'page|' ) === 0;
@@ -408,14 +416,20 @@
409417
410418 foreach ( $wgTranslateGroupStructure as $pattern => $hypergroup ) {
411419 if ( preg_match( $pattern, $id ) ) {
412 - // Emulate deepArraySet, because AFAIK php doesn't have one
 420+ /**
 421+ * Emulate deepArraySet, because AFAIK php does not have one
 422+ */
413423 self::deepArraySet( $structure, $hypergroup, $id, $o );
414 - // We need to continue the outer loop, because we have finished this item
 424+ /**
 425+ * We need to continue the outer loop, because we have finished this item.
 426+ */
415427 continue 2;
416428 }
417429 }
418430
419 - // Does not belong to any subgroup, just shove it into main level
 431+ /**
 432+ * Does not belong to any subgroup, just shove it into main level.
 433+ */
420434 $structure[$id] = $o;
421435 }
422436
Index: trunk/extensions/Translate/MessageCollection.php
@@ -5,7 +5,7 @@
66 * @ingroup Extensions
77 * @file
88 * @author Niklas Laxström
9 - * @copyright Copyright © 2007-2009, Niklas Laxström
 9+ * @copyright Copyright © 2007-2010, Niklas Laxström
1010 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1111 */
1212
@@ -238,7 +238,10 @@
239239 $keys = $this->filterOnCondition( $keys, $translated, $condition );
240240 } elseif ( $filter === 'changed' ) {
241241 $keys = $this->filterChanged( $keys, $condition );
242 - } else { // Filter based on tags
 242+ } else {
 243+ /**
 244+ * Filter based on tags.
 245+ */
243246 if ( !isset( $this->tags[$filter] ) ) {
244247 if ( $filter !== 'optional' && $filter !== 'ignored' ) {
245248 throw new MWException( "No tagged messages for custom filter $filter" );
@@ -469,7 +472,7 @@
470473 $flipKeys = array_flip( $this->keys );
471474
472475 /**
473 - * Copy rows if any
 476+ * Copy rows if any.
474477 */
475478 if ( $this->dbData !== null ) {
476479 foreach ( $this->dbData as $row ) {
@@ -498,7 +501,7 @@
499502 }
500503
501504 /**
502 - * Copy tags if any
 505+ * Copy tags if any.
503506 */
504507 foreach ( $this->tags as $type => $keys ) {
505508 foreach ( $keys as $key ) {
@@ -509,7 +512,7 @@
510513 }
511514
512515 /**
513 - * Copy infile if any
 516+ * Copy infile if any.
514517 */
515518 foreach ( $this->infile as $key => $value ) {
516519 if ( isset( $messages[$key] ) ) {
Index: trunk/extensions/Translate/SpecialLanguageStats.php
@@ -27,7 +27,9 @@
2828
2929 $wgOut->addExtensionStyle( TranslateUtils::assetPath( 'Translate.css' ) );
3030
31 - # no UI when including()
 31+ /**
 32+ * no UI when including()
 33+ */
3234 if ( !$this->including() ) {
3335 $code = $wgRequest->getVal( 'code', $par );
3436 $suppressComplete = $wgRequest->getVal( 'suppresscomplete', $par );
@@ -123,7 +125,7 @@
124126
125127 if ( $fuzzy ) {
126128 /**
127 - * weigh fuzzy with factor 20.
 129+ * Weigh fuzzy with factor 20.
128130 */
129131 $v = $v * 20;
130132 if ( $v > 255 ) $v = 255;
Index: trunk/extensions/Translate/MessageChecks.php
@@ -108,6 +108,7 @@
109109 public function checkMessageFast( TMessage $message, $code ) {
110110 $warningsArray = array();
111111 $messages = array( $message );
 112+
112113 foreach ( $this->checks as $check ) {
113114 call_user_func_array( $check, array( $messages, $code, &$warningsArray ) );
114115 if ( count( $warningsArray ) ) {
@@ -128,14 +129,34 @@
129130 * There is an array of messages...
130131 */
131132 foreach ( $warningsArray as $mkey => $warnings ) {
132 - // ... each which have array of warnings
 133+ /**
 134+ * ... each which has an array of warnings.
 135+ */
133136 foreach ( $warnings as $wkey => $warning ) {
134137 $check = array_shift( $warning );
 138+ /**
 139+ * Check if the key is blacklisted...
 140+ */
135141 foreach ( self::$globalBlacklist as $pattern ) {
 142+ /**
 143+ * ... based on message group
 144+ */
136145 if ( !$this->match( $pattern['group'], $groupId ) ) continue;
 146+ /**
 147+ * ... based on check
 148+ */
137149 if ( !$this->match( $pattern['check'], $check[0] ) ) continue;
 150+ /**
 151+ * ... based on subcheck
 152+ */
138153 if ( !$this->match( $pattern['subcheck'], $check[1] ) ) continue;
 154+ /**
 155+ * ... based on message
 156+ */
139157 if ( !$this->match( $pattern['message'], $check[2] ) ) continue;
 158+ /**
 159+ * ... based on code
 160+ */
140161 if ( !$this->match( $pattern['code'], $check[3] ) ) continue;
141162
142163 unset( $warningsArray[$mkey][$wkey] );
Index: trunk/extensions/Translate/SpecialFirstSteps.php
@@ -3,7 +3,6 @@
44 * @todo Needs documentation
55 * @file
66 * @author Niklas Laxström
7 - *
87 * @copyright Copyright © 2010, Niklas Laxström
98 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
109 */
Index: trunk/extensions/Translate/SpecialSupportedLanguages.php
@@ -15,6 +15,9 @@
1616 public function execute( $par ) {
1717 global $wgLang, $wgOut;
1818
 19+ /**
 20+ * Requires NS_PORTAL. If not present, display error text.
 21+ */
1922 if ( !defined( 'NS_PORTAL' ) ) {
2023 $wgOut->showErrorPage( 'supportedlanguages-noportal-title', 'supportedlanguages-noportal' );
2124 return;
Index: trunk/extensions/Translate/SpecialImportTranslations.php
@@ -4,7 +4,6 @@
55 *
66 * @file
77 * @ingroup Extensions
8 - *
98 * @author Niklas Laxström
109 * @copyright Copyright © 2009, Niklas Laxström
1110 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
@@ -24,7 +23,7 @@
2524
2625 /**
2726 * Dependencies
28 - */
 27+ */
2928 protected $user, $out, $request;
3029
3130 /**
@@ -47,7 +46,10 @@
4847 }
4948
5049 if ( !$this->user->matchEditToken( $this->request->getVal( 'token' ) ) ) {
51 - $this->out->addWikiMsg( 'session_fail_preview' ); // Core... bad
 50+ /**
 51+ * @todo Core... bad.
 52+ */
 53+ $this->out->addWikiMsg( 'session_fail_preview' );
5254 $this->outputForm();
5355 return;
5456 }
@@ -55,7 +57,10 @@
5658 if ( $this->request->getCheck( 'process' ) ) {
5759 $data = $this->getCachedData();
5860 if ( !$data ) {
59 - $this->out->addWikiMsg( 'session_fail_preview' ); // Core... bad
 61+ /**
 62+ * @todo Core... bad.
 63+ */
 64+ $this->out->addWikiMsg( 'session_fail_preview' );
6065 $this->outputForm();
6166 return;
6267 }
@@ -149,7 +154,10 @@
150155 $this->request->getText( 'upload-type' ) === 'wiki' ) .
151156 "\n" . Xml::closeElement( 'td' ) . Xml::openElement( 'td' ) . "\n" .
152157 Xml::input( 'upload-wiki', 50,
153 - $this->request->getText( 'upload-wiki', 'File:' ), // FIXME: needs i18n in content language.
 158+ /**
 159+ * @todo Needs i18n in content language.
 160+ */
 161+ $this->request->getText( 'upload-wiki', 'File:' ),
154162 array( 'id' => 'mw-translate-up-wiki-input' ) + $class ) .
155163 "\n" . Xml::closeElement( 'td' ) . Xml::closeElement( 'tr' ) .
156164 Xml::openElement( 'tr' ) . Xml::openElement( 'td' ) . "\n" .
@@ -174,7 +182,6 @@
175183 $source = $this->request->getText( 'upload-type' );
176184
177185 if ( $source === 'url' ) {
178 - # return array( 'type-not-supported', $source );
179186 $url = $this->request->getText( 'upload-url' );
180187 $filedata = Http::get( $url ); ;
181188 if ( $filedata ) {
@@ -250,7 +257,10 @@
251258 protected function setCachedData( $data ) {
252259 global $wgMemc;
253260 $key = wfMemcKey( 'translate', 'webimport', $this->user->getId() );
254 - $wgMemc->set( $key, $data, 60 * 15 ); // 15 minutes
 261+ /**
 262+ * 15 minutes.
 263+ */
 264+ $wgMemc->set( $key, $data, 60 * 15 );
255265 }
256266
257267 protected function getCachedData() {
Index: trunk/extensions/Translate/SpecialTranslationStats.php
@@ -1,5 +1,16 @@
22 <?php
 3+/**
 4+ * Includable special page for generating graphs on translations.
 5+ *
 6+ * @file
 7+ * @author Niklas Laxström
 8+ * @copyright Copyright © 2008-2010, Niklas Laxström
 9+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
 10+ */
311
 12+/**
 13+ * @todo Needs documentation.
 14+ */
415 class SpecialTranslationStats extends SpecialPage {
516 public function __construct() {
617 parent::__construct( 'TranslationStats' );
@@ -403,6 +414,9 @@
404415 }
405416 }
406417
 418+/**
 419+ * @todo Needs documentation.
 420+ */
407421 interface TranslationStatsInterface {
408422 public function __construct( FormOptions $opts );
409423 public function preQuery( &$tables, &$fields, &$conds, &$type, &$options, $cutoff );
@@ -412,8 +426,13 @@
413427 public function getDateFormat();
414428 }
415429
 430+/**
 431+ * @todo Needs documentation.
 432+ */
416433 abstract class TranslationStatsBase implements TranslationStatsInterface {
417 - /** FormOptions */
 434+ /**
 435+ * FormOptions
 436+ */
418437 protected $opts;
419438
420439 public function __construct( FormOptions $opts ) {
@@ -441,12 +460,17 @@
442461 }
443462 }
444463
 464+/**
 465+ * @todo Needs documentation.
 466+ */
445467 class TranslatePerLanguageStats extends TranslationStatsBase {
446468 protected $usercache;
447469
448470 public function __construct( FormOptions $opts ) {
449471 parent::__construct( $opts );
450 - // This query is slow... ensure a slower limit
 472+ /**
 473+ * This query is slow... ensure a slower limit.
 474+ */
451475 $opts->validateIntBounds( 'days', 1, 200 );
452476 }
453477
@@ -501,7 +525,9 @@
502526 }
503527
504528 public function indexOf( $row ) {
505 - // We need to check that there is only one user per day
 529+ /**
 530+ * We need to check that there is only one user per day.
 531+ */
506532 if ( $this->opts['count'] === 'users' ) {
507533 $date = $this->formatTimestamp( $row->rc_timestamp );
508534
@@ -512,22 +538,29 @@
513539 }
514540 }
515541
516 - // Don't consider language-less pages
 542+ /**
 543+ * Do not consider language-less pages.
 544+ */
517545 if ( strpos( $row->rc_title, '/' ) === false ) return false;
518546
519 - // No filters, just one key to track
 547+ /**
 548+ * No filters, just one key to track.
 549+ */
520550 if ( !$this->groups && !$this->codes ) return 'all';
521551
522 - // The key-building needs to be in sync with ::labels()
523 -
 552+ /**
 553+ * The key-building needs to be in sync with ::labels().
 554+ */
524555 list( $key, $code ) = TranslateUtils::figureMessage( $row->rc_title );
525556
526557 $groups = array();
527558 $codes = array();
528559
529560 if ( $this->groups ) {
530 - /* Get list of keys that the message belongs to, and filter
531 - * out those which are not requested */
 561+ /**
 562+ * Get list of keys that the message belongs to, and filter
 563+ * out those which are not requested.
 564+ */
532565 $groups = TranslateUtils::messageKeyToGroups( $row->rc_namespace, $key );
533566 $groups = array_intersect( $this->groups, $groups );
534567 }
@@ -588,8 +621,10 @@
589622
590623 }
591624
 625+/**
 626+ * @todo Needs documentation.
 627+ */
592628 class TranslateRegistrationStats extends TranslationStatsBase {
593 -
594629 public function preQuery( &$tables, &$fields, &$conds, &$type, &$options, $cutoff ) {
595630 $db = wfGetDB( DB_SLAVE );
596631 $tables = 'user';
@@ -602,5 +637,4 @@
603638 public function getTimestamp( $row ) {
604639 return $row->user_registration;
605640 }
606 -
607641 }
Index: trunk/extensions/Translate/check-blacklist.php
@@ -1,12 +1,16 @@
22 <?php
33 /**
4 - * @todo Needs documentation.
54 * @file
65 * @author Niklas Laxström
76 * @copyright Copyright © 2008-2010, Niklas Laxström
87 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
98 */
109
 10+/**
 11+ * List of checks that should not be performed.
 12+ *
 13+ * @todo Needs documentation.
 14+ */
1115 $checkBlacklist = array(
1216
1317 array(
Index: trunk/extensions/Translate/MessageGroups.php
@@ -8,6 +8,9 @@
99 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1010 */
1111
 12+/**
 13+ * @deprecated
 14+ */
1215 abstract class MessageGroupOld implements MessageGroup {
1316 /**
1417 * Human-readable name of this group
Index: trunk/extensions/Translate/TranslateEditAddons.php
@@ -5,7 +5,7 @@
66 *
77 * @author Niklas Laxström
88 * @author Siebrand Mazeland
9 - * @copyright Copyright © 2007-2009 Niklas Laxström
 9+ * @copyright Copyright © 2007-2010 Niklas Laxström, Siebrand Mazeland
1010 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1111 */
1212
@@ -58,9 +58,11 @@
5959 continue;
6060 }
6161
62 - // Keys can have mixed case, but they have to be unique in a case
63 - // insensitive manner. It is therefore safe and a must to use case
64 - // insensitive comparison method
 62+ /**
 63+ * Keys can have mixed case, but they have to be unique in a case
 64+ * insensitive manner. It is therefore safe and a must to use case
 65+ * insensitive comparison method.
 66+ */
6567 if ( $key === strtolower( strtr( $tkey, ' ', '_' ) ) ) {
6668 $next = true;
6769 $def = $defs[$tkey];
@@ -217,9 +219,13 @@
218220 $group = $wgRequest->getText( 'loadgroup', '' );
219221 $mg = MessageGroups::getGroup( $group );
220222
221 - # If we were not given group, or the group given was meta...
 223+ /**
 224+ * If we were not given group, or the group given was meta...
 225+ */
222226 if ( is_null( $mg ) || $mg->isMeta() ) {
223 - # .. then try harder, because meta groups are *inefficient*
 227+ /**
 228+ * .. then try harder, because meta groups are *inefficient*.
 229+ */
224230 $group = TranslateUtils::messageKeyToGroup( $namespace, $key );
225231 if ( $group ) {
226232 $mg = MessageGroups::getGroup( $group );
@@ -309,7 +315,9 @@
310316
311317 list( $key, $code, $group ) = self::getKeyCodeGroup( $title );
312318
313 - // Unknown message, do not handle
 319+ /**
 320+ * Unknown message, do not handle.
 321+ */
314322 if ( !$group || !$code ) {
315323 return true;
316324 }
@@ -321,10 +329,14 @@
322330 $cache->clear( $g, $code );
323331 }
324332
325 - // Check for explicit tag
 333+ /**
 334+ * Check for explicit tag.
 335+ */
326336 $fuzzy = self::hasFuzzyString( $text );
327337
328 - // Check for problems, but only if not fuzzy already
 338+ /**
 339+ * Check for problems, but only if not fuzzy already.
 340+ */
329341 global $wgTranslateDocumentationLanguageCode;
330342 if ( $code !== $wgTranslateDocumentationLanguageCode ) {
331343 $checker = $group->getChecker();
@@ -332,7 +344,9 @@
333345 if ( $checker ) {
334346 $en = $group->getMessage( $key, 'en' );
335347 $message = new FatMessage( $key, $en );
336 - // Take the contents from edit field as a translation
 348+ /**
 349+ * Take the contents from edit field as a translation.
 350+ */
337351 $message->setTranslation( $text );
338352
339353 $checks = $checker->checkMessage( $message, $code );
@@ -342,14 +356,18 @@
343357 }
344358 }
345359
346 - // Update it
 360+ /**
 361+ * Update it.
 362+ */
347363 if ( $revision === null ) {
348364 $rev = $article->getTitle()->getLatestRevId();
349365 } else {
350366 $rev = $revision->getID();
351367 }
352368
353 - // <fuzzy tag
 369+ /**
 370+ * begin fuzzy tag.
 371+ */
354372 $dbw = wfGetDB( DB_MASTER );
355373
356374 $id = $dbw->selectField( 'revtag_type', 'rtt_id', array( 'rtt_name' => 'fuzzy' ), __METHOD__ );
@@ -359,16 +377,24 @@
360378 'rt_type' => $id,
361379 'rt_revision' => $rev
362380 );
363 - // Remove any existing fuzzy tags for this revision
 381+ /**
 382+ * Remove any existing fuzzy tags for this revision
 383+ */
364384 $dbw->delete( 'revtag', $conds, __METHOD__ );
365385
366 - // Add the fuzzy tag if needed
 386+ /**
 387+ * Add the fuzzy tag if needed.
 388+ */
367389 if ( $fuzzy !== false ) {
368390 $dbw->insert( 'revtag', $conds, __METHOD__ );
369391 }
370 - // fuzzy>
 392+ /**
 393+ * End fuzzy
 394+ */
371395
372 - // Diffs for changed messages
 396+ /**
 397+ * Diffs for changed messages.
 398+ */
373399 if ( $fuzzy !== false ) {
374400 return true;
375401 }
Index: trunk/extensions/Translate/Translate.php
@@ -8,8 +8,7 @@
99 *
1010 * @author Niklas Laxström
1111 * @author Siebrand Mazeland
12 - * @copyright Copyright © 2006-2010, Niklas Laxström
13 - * @copyright Copyright © 2007-2010, Siebrand Mazeland
 12+ * @copyright Copyright © 2006-2010, Niklas Laxström, Siebrand Mazeland
1413 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1514 */
1615
Index: trunk/extensions/Translate/TranslateTasks.php
@@ -48,7 +48,9 @@
4949 abstract class TranslateTask {
5050 protected $id = '__BUG__';
5151
52 - /* We need $id here because staticness prevents subclass overriding */
 52+ /**
 53+ * We need $id here because staticness prevents subclass overriding.
 54+ */
5355 public static function labelForTask( $id ) {
5456 return wfMsg( TranslateUtils::MSG . 'task-' . $id );
5557 }
@@ -93,6 +95,9 @@
9496 }
9597 }
9698
 99+/**
 100+ * @todo Needs documentation.
 101+ */
97102 class ViewMessagesTask extends TranslateTask {
98103 protected $id = 'view';
99104
@@ -116,6 +121,9 @@
117122 }
118123 }
119124
 125+/**
 126+ * @todo Needs documentation.
 127+ */
120128 class ReviewMessagesTask extends ViewMessagesTask {
121129 protected $id = 'review';
122130
@@ -137,6 +145,9 @@
138146 }
139147 }
140148
 149+/**
 150+ * @todo Needs documentation.
 151+ */
141152 class ViewUntranslatedTask extends ReviewMessagesTask {
142153 protected $id = 'untranslated';
143154
@@ -147,7 +158,9 @@
148159 $this->collection->filter( 'ignored' );
149160 $this->collection->filter( 'optional' );
150161
151 - // Update the cache while we are at it
 162+ /**
 163+ * Update the cache while we are at it.
 164+ */
152165 $total = count( $this->collection );
153166 $this->collection->filter( 'translated' );
154167 $translated = $total - count( $this->collection );
@@ -158,6 +171,9 @@
159172 }
160173 }
161174
 175+/**
 176+ * @todo Needs documentation.
 177+ */
162178 class ViewOptionalTask extends ViewMessagesTask {
163179 protected $id = 'optional';
164180
@@ -170,6 +186,9 @@
171187 }
172188 }
173189
 190+/**
 191+ * @todo Needs documentation.
 192+ */
174193 class ViewWithSuggestionsTask extends ViewMessagesTask {
175194 protected $id = 'suggestions';
176195
@@ -192,7 +211,9 @@
193212 $start = time();
194213
195214 foreach ( $this->collection->keys() as $key => $_ ) {
196 - // Allow up to 10 seconds to search for suggestions.
 215+ /**
 216+ * Allow up to 10 seconds to search for suggestions.
 217+ */
197218 if ( time() - $start > 10 || TranslationHelpers::checkTranslationServiceFailure( 'tmserver' ) ) {
198219 unset( $this->collection[$key] );
199220 continue;
@@ -205,7 +226,9 @@
206227 if ( $suggestions !== false ) {
207228 $suggestions = FormatJson::decode( $suggestions, true );
208229 foreach ( $suggestions as $s ) {
209 - // We have a good suggestion, do not filter
 230+ /**
 231+ * We have a good suggestion, do not filter.
 232+ */
210233 if ( $s['quality'] > 0.80 ) {
211234 continue 2;
212235 }
@@ -218,6 +241,9 @@
219242 }
220243 }
221244
 245+/**
 246+ * @todo Needs documentation.
 247+ */
222248 class ViewUntranslatedOptionalTask extends ViewOptionalTask {
223249 protected $id = 'untranslatedoptional';
224250
@@ -231,6 +257,9 @@
232258 }
233259 }
234260
 261+/**
 262+ * @todo Needs documentation.
 263+ */
235264 class ReviewAllMessagesTask extends ReviewMessagesTask {
236265 protected $id = 'reviewall';
237266
@@ -243,10 +272,15 @@
244273 }
245274 }
246275
 276+/**
 277+ * @todo Needs documentation.
 278+ */
247279 class ExportMessagesTask extends ViewMessagesTask {
248280 protected $id = 'export';
249281
250 - // N/A
 282+ /**
 283+ * N/A.
 284+ */
251285 protected function doPaging() { }
252286
253287 public function output() {
@@ -264,6 +298,9 @@
265299 }
266300 }
267301
 302+/**
 303+ * @todo Needs documentation.
 304+ */
268305 class ExportToFileMessagesTask extends ExportMessagesTask {
269306 protected $id = 'export-to-file';
270307
@@ -284,6 +321,9 @@
285322 }
286323 }
287324
 325+/**
 326+ * @todo Needs documentation.
 327+ */
288328 class ExportToXliffMessagesTask extends ExportToFileMessagesTask {
289329 protected $id = 'export-to-xliff';
290330
@@ -293,6 +333,9 @@
294334 }
295335 }
296336
 337+/**
 338+ * @todo Needs documentation.
 339+ */
297340 class ExportAsPoMessagesTask extends ExportMessagesTask {
298341 protected $id = 'export-as-po';
299342
@@ -316,9 +359,13 @@
317360
318361 $headers = array();
319362 $headers['Project-Id-Version'] = 'MediaWiki ' . SpecialVersion::getVersion( 'nodb' );
320 - // TODO: make this customisable or something
 363+ /**
 364+ * @todo Make this customisable or something.
 365+ */
321366 $headers['Report-Msgid-Bugs-To'] = $wgServer;
322 - // TODO: sprintfDate doesn't support any time zone flags
 367+ /**
 368+ * @todo sprintfDate does not support any time zone flags.
 369+ */
323370 $headers['POT-Creation-Date'] = $lang->sprintfDate( 'xnY-xnm-xnd xnH:xni:xns+0000', $now );
324371 $headers['Language-Team'] = TranslateUtils::getLanguageName( $this->options->getLanguage() );
325372 $headers['Content-Type'] = 'text-plain; charset=UTF-8';
@@ -339,17 +386,23 @@
340387 $flags = array();
341388
342389 $translation = $m->translation();
343 - # CASE2: no translation
 390+ /**
 391+ * CASE2: no translation.
 392+ */
344393 if ( $translation === null ) {
345394 $translation = '';
346395 }
347396
348 - # CASE3: optional messages; accept only if different
 397+ /**
 398+ * CASE3: optional messages; accept only if different.
 399+ */
349400 if ( $m->hasTag( 'optional' ) ) {
350401 $flags[] = 'optional';
351402 }
352403
353 - # Remove fuzzy markings before export
 404+ /**
 405+ * Remove fuzzy markings before export.
 406+ */
354407 if ( strpos( $translation, TRANSLATE_FUZZY ) !== false ) {
355408 $translation = str_replace( TRANSLATE_FUZZY, '', $translation );
356409 $flags[] = 'fuzzy';
@@ -421,11 +474,16 @@
422475 }
423476 }
424477
 478+/**
 479+ * @todo Needs documentation.
 480+ */
425481 class TranslateTasks {
426482 public static function getTasks( $pageTranslation = false ) {
427483 global $wgTranslateTasks, $wgTranslateTranslationServices;
428484
429 - // Tasks not to be available in page translation
 485+ /**
 486+ * Tasks not to be available in page translation.
 487+ */
430488 $filterTasks = array(
431489 'optional',
432490 'untranslatedoptional',
Index: trunk/extensions/Translate/Translate.i18n.php
@@ -2,6 +2,7 @@
33 /**
44 * Translations of Translate extension.
55 *
 6+ * @file
67 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
78 */
89
Index: trunk/extensions/Translate/TranslateUtils.php
@@ -2,6 +2,7 @@
33 /**
44 * This class contains some static helper functions for other classes.
55 *
 6+ * @file
67 * @author Niklas Laxström
78 * @copyright Copyright © 2007, 2009 Niklas Laxström
89 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
@@ -20,7 +21,9 @@
2122 public static function title( $message, $code ) {
2223 global $wgContLang;
2324
24 - // Cache some amount of titles for speed
 25+ /**
 26+ * Cache some amount of titles for speed.
 27+ */
2528 static $cache = array();
2629 if ( !isset( $cache[$message] ) ) {
2730 $cache[$message] = $wgContLang->ucfirst( $message );
@@ -96,7 +99,6 @@
97100 $recentchanges = $dbr->tableName( 'recentchanges' );
98101 $hours = intval( $hours );
99102 $cutoff_unixtime = time() - ( $hours * 3600 );
100 - # $cutoff_unixtime = $cutoff_unixtime - ($cutoff_unixtime % 86400);
101103 $cutoff = $dbr->timestamp( $cutoff_unixtime );
102104
103105 $namespaces = $dbr->makeList( $wgTranslateMessageNamespaces );
@@ -111,7 +113,9 @@
112114
113115 $res = $dbr->query( $sql, __METHOD__ );
114116
115 - // Fetch results, prepare a batch link existence check query
 117+ /**
 118+ * Fetch results, prepare a batch link existence check query.
 119+ */
116120 $rows = array();
117121 while ( $row = $dbr->fetchObject( $res ) ) {
118122 $rows[] = $row;
@@ -152,13 +156,23 @@
153157 $suffix = '';
154158
155159 $parts1 = isset( $parts[1] ) ? $parts[1] : '';
 160+
 161+ /**
 162+ * @todo Add missing scripts that are in use (deva, arab).
 163+ */
156164 switch ( $parts1 ) {
157165 case 'latn':
158 - $suffix = ' (Latin)'; # TODO: i18n
 166+ /**
 167+ * @todo i18n.
 168+ */
 169+ $suffix = ' (Latin)';
159170 unset( $parts[1] );
160171 break;
161172 case 'cyrl':
162 - $suffix = ' (Cyrillic)'; # TODO: i18n
 173+ /**
 174+ * @todo i18n.
 175+ */
 176+ $suffix = ' (Cyrillic)';
163177 unset( $parts[1] );
164178 break;
165179 }
@@ -194,7 +208,9 @@
195209 self::messageIndex();
196210 }
197211
198 - # Performance hotspot
 212+ /**
 213+ * Performance hotspot.
 214+ */
199215 # $normkey = self::normaliseKey( $namespace, $key );
200216 $normkey = str_replace( " ", "_", strtolower( "$namespace:$key" ) );
201217
@@ -211,7 +227,9 @@
212228 self::messageIndex();
213229 }
214230
215 - # Performance hotspot
 231+ /**
 232+ * Performance hotspot.
 233+ */
216234 # $normkey = self::normaliseKey( $namespace, $key );
217235 $normkey = str_replace( " ", "_", strtolower( "$namespace:$key" ) );
218236
Index: trunk/extensions/Translate/SpecialMagic.php
@@ -48,7 +48,7 @@
4949
5050 /**
5151 * Returns HTML5 output of the form
52 - * GLOBALS: $wgLang
 52+ * GLOBALS: $wgLang, $wgScript
5353 */
5454 protected function getForm() {
5555 global $wgLang, $wgScript;
@@ -127,7 +127,7 @@
128128
129129 /**
130130 * The special page running code
131 - * GLOBALS: $wgRequest, $wgOut, $wgUser, $wgLang
 131+ * GLOBALS: $wgRequest, $wgOut, $wgUser
132132 */
133133 public function execute( $parameters ) {
134134 global $wgUser, $wgOut, $wgRequest;
Index: trunk/extensions/Translate/SpecialTranslations.php
@@ -5,8 +5,7 @@
66 *
77 * @author Siebrand Mazeland
88 * @author Niklas Laxstörm
9 - * @copyright Copyright © 2008 Siebrand Mazeland
10 - * @copyright Copyright © 2009 Niklas Laxström
 9+ * @copyright Copyright © 2008-2010 Niklas Laxström, Siebrand Mazeland
1110 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1211 */
1312
@@ -41,7 +40,9 @@
4241 return;
4342 }
4443
45 - # GET values
 44+ /**
 45+ * GET values.
 46+ */
4647 $message = $wgRequest->getText( 'message' );
4748 $namespace = $wgRequest->getInt( 'namespace', NS_MAIN );
4849 if ( $message !== '' ) {
@@ -142,7 +143,9 @@
143144 return;
144145 }
145146
146 - // Normal output
 147+ /**
 148+ * Normal output.
 149+ */
147150 $titles = array();
148151
149152 foreach ( $res as $s ) {
@@ -160,7 +163,9 @@
161164 $tableheader .= Xml::element( 'th', null, wfMsg( 'allmessagescurrent' ) );
162165 $tableheader .= Xml::closeElement( 'tr' );
163166
164 - // Adapted version of TranslateUtils:makeListing() by Nikerabbit
 167+ /**
 168+ * Adapted version of TranslateUtils:makeListing() by Nikerabbit.
 169+ */
165170 $out = $tableheader;
166171
167172 $canTranslate = $wgUser->isAllowed( 'translate' );
@@ -237,7 +242,9 @@
238243 $wgOut->addScriptFile( TranslateUtils::assetPath( 'js/jquery.form.js' ) );
239244 $wgOut->addExtensionStyle( TranslateUtils::assetPath( 'js/base/custom-theme/jquery-ui-1.7.2.custom.css' ) );
240245
241 - // Might be needed, but ajax doesn't load it
 246+ /**
 247+ * Might be needed, but ajax does not load it.
 248+ */
242249 $diff = new DifferenceEngine;
243250 $diff->showDiffStyle();
244251 }
Index: trunk/extensions/Translate/Translate.alias.php
@@ -2,6 +2,7 @@
33 /**
44 * Aliases for special pages of Translate extension.
55 *
 6+ * @file
67 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
78 */
89

Status & tagging log