Index: trunk/extensions/Translate/TranslatePage.php |
— | — | @@ -78,7 +78,9 @@ |
79 | 79 | $this->options['group'] = $this->defaults['group']; |
80 | 80 | } |
81 | 81 | |
82 | | - // Show errors nicely |
| 82 | + /** |
| 83 | + * Show errors nicely. |
| 84 | + */ |
83 | 85 | $wgOut->addHTML( $this->settingsForm( $errors ) ); |
84 | 86 | |
85 | 87 | if ( count( $errors ) ) { |
— | — | @@ -99,7 +101,9 @@ |
100 | 102 | } |
101 | 103 | } |
102 | 104 | |
103 | | - # Proceed |
| 105 | + /** |
| 106 | + * Proceed. |
| 107 | + */ |
104 | 108 | $taskOptions = new TaskOptions( |
105 | 109 | $this->options['language'], |
106 | 110 | $this->options['limit'], |
— | — | @@ -107,7 +111,9 @@ |
108 | 112 | array( $this, 'cbAddPagingNumbers' ) |
109 | 113 | ); |
110 | 114 | |
111 | | - // Initialise and get output |
| 115 | + /** |
| 116 | + * Initialise and get output. |
| 117 | + */ |
112 | 118 | $this->task->init( $this->group, $taskOptions ); |
113 | 119 | $output = $this->task->execute(); |
114 | 120 | |
— | — | @@ -251,7 +257,9 @@ |
252 | 258 | protected function taskSelector( $pageTranslation = false ) { |
253 | 259 | $selector = new HTMLSelector( 'task', 'task', $this->options['task'] ); |
254 | 260 | |
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 | + */ |
256 | 264 | $isPageTranslation = false; |
257 | 265 | if ( $this->group ) { |
258 | 266 | $isPageTranslation = strpos( $this->group->getId(), 'page|' ) === 0; |
— | — | @@ -408,14 +416,20 @@ |
409 | 417 | |
410 | 418 | foreach ( $wgTranslateGroupStructure as $pattern => $hypergroup ) { |
411 | 419 | 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 | + */ |
413 | 423 | 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 | + */ |
415 | 427 | continue 2; |
416 | 428 | } |
417 | 429 | } |
418 | 430 | |
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 | + */ |
420 | 434 | $structure[$id] = $o; |
421 | 435 | } |
422 | 436 | |
Index: trunk/extensions/Translate/MessageCollection.php |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | * @ingroup Extensions |
7 | 7 | * @file |
8 | 8 | * @author Niklas Laxström |
9 | | - * @copyright Copyright © 2007-2009, Niklas Laxström |
| 9 | + * @copyright Copyright © 2007-2010, Niklas Laxström |
10 | 10 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
11 | 11 | */ |
12 | 12 | |
— | — | @@ -238,7 +238,10 @@ |
239 | 239 | $keys = $this->filterOnCondition( $keys, $translated, $condition ); |
240 | 240 | } elseif ( $filter === 'changed' ) { |
241 | 241 | $keys = $this->filterChanged( $keys, $condition ); |
242 | | - } else { // Filter based on tags |
| 242 | + } else { |
| 243 | + /** |
| 244 | + * Filter based on tags. |
| 245 | + */ |
243 | 246 | if ( !isset( $this->tags[$filter] ) ) { |
244 | 247 | if ( $filter !== 'optional' && $filter !== 'ignored' ) { |
245 | 248 | throw new MWException( "No tagged messages for custom filter $filter" ); |
— | — | @@ -469,7 +472,7 @@ |
470 | 473 | $flipKeys = array_flip( $this->keys ); |
471 | 474 | |
472 | 475 | /** |
473 | | - * Copy rows if any |
| 476 | + * Copy rows if any. |
474 | 477 | */ |
475 | 478 | if ( $this->dbData !== null ) { |
476 | 479 | foreach ( $this->dbData as $row ) { |
— | — | @@ -498,7 +501,7 @@ |
499 | 502 | } |
500 | 503 | |
501 | 504 | /** |
502 | | - * Copy tags if any |
| 505 | + * Copy tags if any. |
503 | 506 | */ |
504 | 507 | foreach ( $this->tags as $type => $keys ) { |
505 | 508 | foreach ( $keys as $key ) { |
— | — | @@ -509,7 +512,7 @@ |
510 | 513 | } |
511 | 514 | |
512 | 515 | /** |
513 | | - * Copy infile if any |
| 516 | + * Copy infile if any. |
514 | 517 | */ |
515 | 518 | foreach ( $this->infile as $key => $value ) { |
516 | 519 | if ( isset( $messages[$key] ) ) { |
Index: trunk/extensions/Translate/SpecialLanguageStats.php |
— | — | @@ -27,7 +27,9 @@ |
28 | 28 | |
29 | 29 | $wgOut->addExtensionStyle( TranslateUtils::assetPath( 'Translate.css' ) ); |
30 | 30 | |
31 | | - # no UI when including() |
| 31 | + /** |
| 32 | + * no UI when including() |
| 33 | + */ |
32 | 34 | if ( !$this->including() ) { |
33 | 35 | $code = $wgRequest->getVal( 'code', $par ); |
34 | 36 | $suppressComplete = $wgRequest->getVal( 'suppresscomplete', $par ); |
— | — | @@ -123,7 +125,7 @@ |
124 | 126 | |
125 | 127 | if ( $fuzzy ) { |
126 | 128 | /** |
127 | | - * weigh fuzzy with factor 20. |
| 129 | + * Weigh fuzzy with factor 20. |
128 | 130 | */ |
129 | 131 | $v = $v * 20; |
130 | 132 | if ( $v > 255 ) $v = 255; |
Index: trunk/extensions/Translate/MessageChecks.php |
— | — | @@ -108,6 +108,7 @@ |
109 | 109 | public function checkMessageFast( TMessage $message, $code ) { |
110 | 110 | $warningsArray = array(); |
111 | 111 | $messages = array( $message ); |
| 112 | + |
112 | 113 | foreach ( $this->checks as $check ) { |
113 | 114 | call_user_func_array( $check, array( $messages, $code, &$warningsArray ) ); |
114 | 115 | if ( count( $warningsArray ) ) { |
— | — | @@ -128,14 +129,34 @@ |
129 | 130 | * There is an array of messages... |
130 | 131 | */ |
131 | 132 | foreach ( $warningsArray as $mkey => $warnings ) { |
132 | | - // ... each which have array of warnings |
| 133 | + /** |
| 134 | + * ... each which has an array of warnings. |
| 135 | + */ |
133 | 136 | foreach ( $warnings as $wkey => $warning ) { |
134 | 137 | $check = array_shift( $warning ); |
| 138 | + /** |
| 139 | + * Check if the key is blacklisted... |
| 140 | + */ |
135 | 141 | foreach ( self::$globalBlacklist as $pattern ) { |
| 142 | + /** |
| 143 | + * ... based on message group |
| 144 | + */ |
136 | 145 | if ( !$this->match( $pattern['group'], $groupId ) ) continue; |
| 146 | + /** |
| 147 | + * ... based on check |
| 148 | + */ |
137 | 149 | if ( !$this->match( $pattern['check'], $check[0] ) ) continue; |
| 150 | + /** |
| 151 | + * ... based on subcheck |
| 152 | + */ |
138 | 153 | if ( !$this->match( $pattern['subcheck'], $check[1] ) ) continue; |
| 154 | + /** |
| 155 | + * ... based on message |
| 156 | + */ |
139 | 157 | if ( !$this->match( $pattern['message'], $check[2] ) ) continue; |
| 158 | + /** |
| 159 | + * ... based on code |
| 160 | + */ |
140 | 161 | if ( !$this->match( $pattern['code'], $check[3] ) ) continue; |
141 | 162 | |
142 | 163 | unset( $warningsArray[$mkey][$wkey] ); |
Index: trunk/extensions/Translate/SpecialFirstSteps.php |
— | — | @@ -3,7 +3,6 @@ |
4 | 4 | * @todo Needs documentation |
5 | 5 | * @file |
6 | 6 | * @author Niklas Laxström |
7 | | - * |
8 | 7 | * @copyright Copyright © 2010, Niklas Laxström |
9 | 8 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
10 | 9 | */ |
Index: trunk/extensions/Translate/SpecialSupportedLanguages.php |
— | — | @@ -15,6 +15,9 @@ |
16 | 16 | public function execute( $par ) { |
17 | 17 | global $wgLang, $wgOut; |
18 | 18 | |
| 19 | + /** |
| 20 | + * Requires NS_PORTAL. If not present, display error text. |
| 21 | + */ |
19 | 22 | if ( !defined( 'NS_PORTAL' ) ) { |
20 | 23 | $wgOut->showErrorPage( 'supportedlanguages-noportal-title', 'supportedlanguages-noportal' ); |
21 | 24 | return; |
Index: trunk/extensions/Translate/SpecialImportTranslations.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | * |
6 | 6 | * @file |
7 | 7 | * @ingroup Extensions |
8 | | - * |
9 | 8 | * @author Niklas Laxström |
10 | 9 | * @copyright Copyright © 2009, Niklas Laxström |
11 | 10 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
— | — | @@ -24,7 +23,7 @@ |
25 | 24 | |
26 | 25 | /** |
27 | 26 | * Dependencies |
28 | | - */ |
| 27 | + */ |
29 | 28 | protected $user, $out, $request; |
30 | 29 | |
31 | 30 | /** |
— | — | @@ -47,7 +46,10 @@ |
48 | 47 | } |
49 | 48 | |
50 | 49 | 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' ); |
52 | 54 | $this->outputForm(); |
53 | 55 | return; |
54 | 56 | } |
— | — | @@ -55,7 +57,10 @@ |
56 | 58 | if ( $this->request->getCheck( 'process' ) ) { |
57 | 59 | $data = $this->getCachedData(); |
58 | 60 | if ( !$data ) { |
59 | | - $this->out->addWikiMsg( 'session_fail_preview' ); // Core... bad |
| 61 | + /** |
| 62 | + * @todo Core... bad. |
| 63 | + */ |
| 64 | + $this->out->addWikiMsg( 'session_fail_preview' ); |
60 | 65 | $this->outputForm(); |
61 | 66 | return; |
62 | 67 | } |
— | — | @@ -149,7 +154,10 @@ |
150 | 155 | $this->request->getText( 'upload-type' ) === 'wiki' ) . |
151 | 156 | "\n" . Xml::closeElement( 'td' ) . Xml::openElement( 'td' ) . "\n" . |
152 | 157 | 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:' ), |
154 | 162 | array( 'id' => 'mw-translate-up-wiki-input' ) + $class ) . |
155 | 163 | "\n" . Xml::closeElement( 'td' ) . Xml::closeElement( 'tr' ) . |
156 | 164 | Xml::openElement( 'tr' ) . Xml::openElement( 'td' ) . "\n" . |
— | — | @@ -174,7 +182,6 @@ |
175 | 183 | $source = $this->request->getText( 'upload-type' ); |
176 | 184 | |
177 | 185 | if ( $source === 'url' ) { |
178 | | - # return array( 'type-not-supported', $source ); |
179 | 186 | $url = $this->request->getText( 'upload-url' ); |
180 | 187 | $filedata = Http::get( $url ); ; |
181 | 188 | if ( $filedata ) { |
— | — | @@ -250,7 +257,10 @@ |
251 | 258 | protected function setCachedData( $data ) { |
252 | 259 | global $wgMemc; |
253 | 260 | $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 ); |
255 | 265 | } |
256 | 266 | |
257 | 267 | protected function getCachedData() { |
Index: trunk/extensions/Translate/SpecialTranslationStats.php |
— | — | @@ -1,5 +1,16 @@ |
2 | 2 | <?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 | + */ |
3 | 11 | |
| 12 | +/** |
| 13 | + * @todo Needs documentation. |
| 14 | + */ |
4 | 15 | class SpecialTranslationStats extends SpecialPage { |
5 | 16 | public function __construct() { |
6 | 17 | parent::__construct( 'TranslationStats' ); |
— | — | @@ -403,6 +414,9 @@ |
404 | 415 | } |
405 | 416 | } |
406 | 417 | |
| 418 | +/** |
| 419 | + * @todo Needs documentation. |
| 420 | + */ |
407 | 421 | interface TranslationStatsInterface { |
408 | 422 | public function __construct( FormOptions $opts ); |
409 | 423 | public function preQuery( &$tables, &$fields, &$conds, &$type, &$options, $cutoff ); |
— | — | @@ -412,8 +426,13 @@ |
413 | 427 | public function getDateFormat(); |
414 | 428 | } |
415 | 429 | |
| 430 | +/** |
| 431 | + * @todo Needs documentation. |
| 432 | + */ |
416 | 433 | abstract class TranslationStatsBase implements TranslationStatsInterface { |
417 | | - /** FormOptions */ |
| 434 | + /** |
| 435 | + * FormOptions |
| 436 | + */ |
418 | 437 | protected $opts; |
419 | 438 | |
420 | 439 | public function __construct( FormOptions $opts ) { |
— | — | @@ -441,12 +460,17 @@ |
442 | 461 | } |
443 | 462 | } |
444 | 463 | |
| 464 | +/** |
| 465 | + * @todo Needs documentation. |
| 466 | + */ |
445 | 467 | class TranslatePerLanguageStats extends TranslationStatsBase { |
446 | 468 | protected $usercache; |
447 | 469 | |
448 | 470 | public function __construct( FormOptions $opts ) { |
449 | 471 | parent::__construct( $opts ); |
450 | | - // This query is slow... ensure a slower limit |
| 472 | + /** |
| 473 | + * This query is slow... ensure a slower limit. |
| 474 | + */ |
451 | 475 | $opts->validateIntBounds( 'days', 1, 200 ); |
452 | 476 | } |
453 | 477 | |
— | — | @@ -501,7 +525,9 @@ |
502 | 526 | } |
503 | 527 | |
504 | 528 | 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 | + */ |
506 | 532 | if ( $this->opts['count'] === 'users' ) { |
507 | 533 | $date = $this->formatTimestamp( $row->rc_timestamp ); |
508 | 534 | |
— | — | @@ -512,22 +538,29 @@ |
513 | 539 | } |
514 | 540 | } |
515 | 541 | |
516 | | - // Don't consider language-less pages |
| 542 | + /** |
| 543 | + * Do not consider language-less pages. |
| 544 | + */ |
517 | 545 | if ( strpos( $row->rc_title, '/' ) === false ) return false; |
518 | 546 | |
519 | | - // No filters, just one key to track |
| 547 | + /** |
| 548 | + * No filters, just one key to track. |
| 549 | + */ |
520 | 550 | if ( !$this->groups && !$this->codes ) return 'all'; |
521 | 551 | |
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 | + */ |
524 | 555 | list( $key, $code ) = TranslateUtils::figureMessage( $row->rc_title ); |
525 | 556 | |
526 | 557 | $groups = array(); |
527 | 558 | $codes = array(); |
528 | 559 | |
529 | 560 | 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 | + */ |
532 | 565 | $groups = TranslateUtils::messageKeyToGroups( $row->rc_namespace, $key ); |
533 | 566 | $groups = array_intersect( $this->groups, $groups ); |
534 | 567 | } |
— | — | @@ -588,8 +621,10 @@ |
589 | 622 | |
590 | 623 | } |
591 | 624 | |
| 625 | +/** |
| 626 | + * @todo Needs documentation. |
| 627 | + */ |
592 | 628 | class TranslateRegistrationStats extends TranslationStatsBase { |
593 | | - |
594 | 629 | public function preQuery( &$tables, &$fields, &$conds, &$type, &$options, $cutoff ) { |
595 | 630 | $db = wfGetDB( DB_SLAVE ); |
596 | 631 | $tables = 'user'; |
— | — | @@ -602,5 +637,4 @@ |
603 | 638 | public function getTimestamp( $row ) { |
604 | 639 | return $row->user_registration; |
605 | 640 | } |
606 | | - |
607 | 641 | } |
Index: trunk/extensions/Translate/check-blacklist.php |
— | — | @@ -1,12 +1,16 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * @todo Needs documentation. |
5 | 4 | * @file |
6 | 5 | * @author Niklas Laxström |
7 | 6 | * @copyright Copyright © 2008-2010, Niklas Laxström |
8 | 7 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
9 | 8 | */ |
10 | 9 | |
| 10 | +/** |
| 11 | + * List of checks that should not be performed. |
| 12 | + * |
| 13 | + * @todo Needs documentation. |
| 14 | + */ |
11 | 15 | $checkBlacklist = array( |
12 | 16 | |
13 | 17 | array( |
Index: trunk/extensions/Translate/MessageGroups.php |
— | — | @@ -8,6 +8,9 @@ |
9 | 9 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
10 | 10 | */ |
11 | 11 | |
| 12 | +/** |
| 13 | + * @deprecated |
| 14 | + */ |
12 | 15 | abstract class MessageGroupOld implements MessageGroup { |
13 | 16 | /** |
14 | 17 | * Human-readable name of this group |
Index: trunk/extensions/Translate/TranslateEditAddons.php |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | * |
7 | 7 | * @author Niklas Laxström |
8 | 8 | * @author Siebrand Mazeland |
9 | | - * @copyright Copyright © 2007-2009 Niklas Laxström |
| 9 | + * @copyright Copyright © 2007-2010 Niklas Laxström, Siebrand Mazeland |
10 | 10 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
11 | 11 | */ |
12 | 12 | |
— | — | @@ -58,9 +58,11 @@ |
59 | 59 | continue; |
60 | 60 | } |
61 | 61 | |
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 | + */ |
65 | 67 | if ( $key === strtolower( strtr( $tkey, ' ', '_' ) ) ) { |
66 | 68 | $next = true; |
67 | 69 | $def = $defs[$tkey]; |
— | — | @@ -217,9 +219,13 @@ |
218 | 220 | $group = $wgRequest->getText( 'loadgroup', '' ); |
219 | 221 | $mg = MessageGroups::getGroup( $group ); |
220 | 222 | |
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 | + */ |
222 | 226 | 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 | + */ |
224 | 230 | $group = TranslateUtils::messageKeyToGroup( $namespace, $key ); |
225 | 231 | if ( $group ) { |
226 | 232 | $mg = MessageGroups::getGroup( $group ); |
— | — | @@ -309,7 +315,9 @@ |
310 | 316 | |
311 | 317 | list( $key, $code, $group ) = self::getKeyCodeGroup( $title ); |
312 | 318 | |
313 | | - // Unknown message, do not handle |
| 319 | + /** |
| 320 | + * Unknown message, do not handle. |
| 321 | + */ |
314 | 322 | if ( !$group || !$code ) { |
315 | 323 | return true; |
316 | 324 | } |
— | — | @@ -321,10 +329,14 @@ |
322 | 330 | $cache->clear( $g, $code ); |
323 | 331 | } |
324 | 332 | |
325 | | - // Check for explicit tag |
| 333 | + /** |
| 334 | + * Check for explicit tag. |
| 335 | + */ |
326 | 336 | $fuzzy = self::hasFuzzyString( $text ); |
327 | 337 | |
328 | | - // Check for problems, but only if not fuzzy already |
| 338 | + /** |
| 339 | + * Check for problems, but only if not fuzzy already. |
| 340 | + */ |
329 | 341 | global $wgTranslateDocumentationLanguageCode; |
330 | 342 | if ( $code !== $wgTranslateDocumentationLanguageCode ) { |
331 | 343 | $checker = $group->getChecker(); |
— | — | @@ -332,7 +344,9 @@ |
333 | 345 | if ( $checker ) { |
334 | 346 | $en = $group->getMessage( $key, 'en' ); |
335 | 347 | $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 | + */ |
337 | 351 | $message->setTranslation( $text ); |
338 | 352 | |
339 | 353 | $checks = $checker->checkMessage( $message, $code ); |
— | — | @@ -342,14 +356,18 @@ |
343 | 357 | } |
344 | 358 | } |
345 | 359 | |
346 | | - // Update it |
| 360 | + /** |
| 361 | + * Update it. |
| 362 | + */ |
347 | 363 | if ( $revision === null ) { |
348 | 364 | $rev = $article->getTitle()->getLatestRevId(); |
349 | 365 | } else { |
350 | 366 | $rev = $revision->getID(); |
351 | 367 | } |
352 | 368 | |
353 | | - // <fuzzy tag |
| 369 | + /** |
| 370 | + * begin fuzzy tag. |
| 371 | + */ |
354 | 372 | $dbw = wfGetDB( DB_MASTER ); |
355 | 373 | |
356 | 374 | $id = $dbw->selectField( 'revtag_type', 'rtt_id', array( 'rtt_name' => 'fuzzy' ), __METHOD__ ); |
— | — | @@ -359,16 +377,24 @@ |
360 | 378 | 'rt_type' => $id, |
361 | 379 | 'rt_revision' => $rev |
362 | 380 | ); |
363 | | - // Remove any existing fuzzy tags for this revision |
| 381 | + /** |
| 382 | + * Remove any existing fuzzy tags for this revision |
| 383 | + */ |
364 | 384 | $dbw->delete( 'revtag', $conds, __METHOD__ ); |
365 | 385 | |
366 | | - // Add the fuzzy tag if needed |
| 386 | + /** |
| 387 | + * Add the fuzzy tag if needed. |
| 388 | + */ |
367 | 389 | if ( $fuzzy !== false ) { |
368 | 390 | $dbw->insert( 'revtag', $conds, __METHOD__ ); |
369 | 391 | } |
370 | | - // fuzzy> |
| 392 | + /** |
| 393 | + * End fuzzy |
| 394 | + */ |
371 | 395 | |
372 | | - // Diffs for changed messages |
| 396 | + /** |
| 397 | + * Diffs for changed messages. |
| 398 | + */ |
373 | 399 | if ( $fuzzy !== false ) { |
374 | 400 | return true; |
375 | 401 | } |
Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -8,8 +8,7 @@ |
9 | 9 | * |
10 | 10 | * @author Niklas Laxström |
11 | 11 | * @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 |
14 | 13 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
15 | 14 | */ |
16 | 15 | |
Index: trunk/extensions/Translate/TranslateTasks.php |
— | — | @@ -48,7 +48,9 @@ |
49 | 49 | abstract class TranslateTask { |
50 | 50 | protected $id = '__BUG__'; |
51 | 51 | |
52 | | - /* We need $id here because staticness prevents subclass overriding */ |
| 52 | + /** |
| 53 | + * We need $id here because staticness prevents subclass overriding. |
| 54 | + */ |
53 | 55 | public static function labelForTask( $id ) { |
54 | 56 | return wfMsg( TranslateUtils::MSG . 'task-' . $id ); |
55 | 57 | } |
— | — | @@ -93,6 +95,9 @@ |
94 | 96 | } |
95 | 97 | } |
96 | 98 | |
| 99 | +/** |
| 100 | + * @todo Needs documentation. |
| 101 | + */ |
97 | 102 | class ViewMessagesTask extends TranslateTask { |
98 | 103 | protected $id = 'view'; |
99 | 104 | |
— | — | @@ -116,6 +121,9 @@ |
117 | 122 | } |
118 | 123 | } |
119 | 124 | |
| 125 | +/** |
| 126 | + * @todo Needs documentation. |
| 127 | + */ |
120 | 128 | class ReviewMessagesTask extends ViewMessagesTask { |
121 | 129 | protected $id = 'review'; |
122 | 130 | |
— | — | @@ -137,6 +145,9 @@ |
138 | 146 | } |
139 | 147 | } |
140 | 148 | |
| 149 | +/** |
| 150 | + * @todo Needs documentation. |
| 151 | + */ |
141 | 152 | class ViewUntranslatedTask extends ReviewMessagesTask { |
142 | 153 | protected $id = 'untranslated'; |
143 | 154 | |
— | — | @@ -147,7 +158,9 @@ |
148 | 159 | $this->collection->filter( 'ignored' ); |
149 | 160 | $this->collection->filter( 'optional' ); |
150 | 161 | |
151 | | - // Update the cache while we are at it |
| 162 | + /** |
| 163 | + * Update the cache while we are at it. |
| 164 | + */ |
152 | 165 | $total = count( $this->collection ); |
153 | 166 | $this->collection->filter( 'translated' ); |
154 | 167 | $translated = $total - count( $this->collection ); |
— | — | @@ -158,6 +171,9 @@ |
159 | 172 | } |
160 | 173 | } |
161 | 174 | |
| 175 | +/** |
| 176 | + * @todo Needs documentation. |
| 177 | + */ |
162 | 178 | class ViewOptionalTask extends ViewMessagesTask { |
163 | 179 | protected $id = 'optional'; |
164 | 180 | |
— | — | @@ -170,6 +186,9 @@ |
171 | 187 | } |
172 | 188 | } |
173 | 189 | |
| 190 | +/** |
| 191 | + * @todo Needs documentation. |
| 192 | + */ |
174 | 193 | class ViewWithSuggestionsTask extends ViewMessagesTask { |
175 | 194 | protected $id = 'suggestions'; |
176 | 195 | |
— | — | @@ -192,7 +211,9 @@ |
193 | 212 | $start = time(); |
194 | 213 | |
195 | 214 | 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 | + */ |
197 | 218 | if ( time() - $start > 10 || TranslationHelpers::checkTranslationServiceFailure( 'tmserver' ) ) { |
198 | 219 | unset( $this->collection[$key] ); |
199 | 220 | continue; |
— | — | @@ -205,7 +226,9 @@ |
206 | 227 | if ( $suggestions !== false ) { |
207 | 228 | $suggestions = FormatJson::decode( $suggestions, true ); |
208 | 229 | foreach ( $suggestions as $s ) { |
209 | | - // We have a good suggestion, do not filter |
| 230 | + /** |
| 231 | + * We have a good suggestion, do not filter. |
| 232 | + */ |
210 | 233 | if ( $s['quality'] > 0.80 ) { |
211 | 234 | continue 2; |
212 | 235 | } |
— | — | @@ -218,6 +241,9 @@ |
219 | 242 | } |
220 | 243 | } |
221 | 244 | |
| 245 | +/** |
| 246 | + * @todo Needs documentation. |
| 247 | + */ |
222 | 248 | class ViewUntranslatedOptionalTask extends ViewOptionalTask { |
223 | 249 | protected $id = 'untranslatedoptional'; |
224 | 250 | |
— | — | @@ -231,6 +257,9 @@ |
232 | 258 | } |
233 | 259 | } |
234 | 260 | |
| 261 | +/** |
| 262 | + * @todo Needs documentation. |
| 263 | + */ |
235 | 264 | class ReviewAllMessagesTask extends ReviewMessagesTask { |
236 | 265 | protected $id = 'reviewall'; |
237 | 266 | |
— | — | @@ -243,10 +272,15 @@ |
244 | 273 | } |
245 | 274 | } |
246 | 275 | |
| 276 | +/** |
| 277 | + * @todo Needs documentation. |
| 278 | + */ |
247 | 279 | class ExportMessagesTask extends ViewMessagesTask { |
248 | 280 | protected $id = 'export'; |
249 | 281 | |
250 | | - // N/A |
| 282 | + /** |
| 283 | + * N/A. |
| 284 | + */ |
251 | 285 | protected function doPaging() { } |
252 | 286 | |
253 | 287 | public function output() { |
— | — | @@ -264,6 +298,9 @@ |
265 | 299 | } |
266 | 300 | } |
267 | 301 | |
| 302 | +/** |
| 303 | + * @todo Needs documentation. |
| 304 | + */ |
268 | 305 | class ExportToFileMessagesTask extends ExportMessagesTask { |
269 | 306 | protected $id = 'export-to-file'; |
270 | 307 | |
— | — | @@ -284,6 +321,9 @@ |
285 | 322 | } |
286 | 323 | } |
287 | 324 | |
| 325 | +/** |
| 326 | + * @todo Needs documentation. |
| 327 | + */ |
288 | 328 | class ExportToXliffMessagesTask extends ExportToFileMessagesTask { |
289 | 329 | protected $id = 'export-to-xliff'; |
290 | 330 | |
— | — | @@ -293,6 +333,9 @@ |
294 | 334 | } |
295 | 335 | } |
296 | 336 | |
| 337 | +/** |
| 338 | + * @todo Needs documentation. |
| 339 | + */ |
297 | 340 | class ExportAsPoMessagesTask extends ExportMessagesTask { |
298 | 341 | protected $id = 'export-as-po'; |
299 | 342 | |
— | — | @@ -316,9 +359,13 @@ |
317 | 360 | |
318 | 361 | $headers = array(); |
319 | 362 | $headers['Project-Id-Version'] = 'MediaWiki ' . SpecialVersion::getVersion( 'nodb' ); |
320 | | - // TODO: make this customisable or something |
| 363 | + /** |
| 364 | + * @todo Make this customisable or something. |
| 365 | + */ |
321 | 366 | $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 | + */ |
323 | 370 | $headers['POT-Creation-Date'] = $lang->sprintfDate( 'xnY-xnm-xnd xnH:xni:xns+0000', $now ); |
324 | 371 | $headers['Language-Team'] = TranslateUtils::getLanguageName( $this->options->getLanguage() ); |
325 | 372 | $headers['Content-Type'] = 'text-plain; charset=UTF-8'; |
— | — | @@ -339,17 +386,23 @@ |
340 | 387 | $flags = array(); |
341 | 388 | |
342 | 389 | $translation = $m->translation(); |
343 | | - # CASE2: no translation |
| 390 | + /** |
| 391 | + * CASE2: no translation. |
| 392 | + */ |
344 | 393 | if ( $translation === null ) { |
345 | 394 | $translation = ''; |
346 | 395 | } |
347 | 396 | |
348 | | - # CASE3: optional messages; accept only if different |
| 397 | + /** |
| 398 | + * CASE3: optional messages; accept only if different. |
| 399 | + */ |
349 | 400 | if ( $m->hasTag( 'optional' ) ) { |
350 | 401 | $flags[] = 'optional'; |
351 | 402 | } |
352 | 403 | |
353 | | - # Remove fuzzy markings before export |
| 404 | + /** |
| 405 | + * Remove fuzzy markings before export. |
| 406 | + */ |
354 | 407 | if ( strpos( $translation, TRANSLATE_FUZZY ) !== false ) { |
355 | 408 | $translation = str_replace( TRANSLATE_FUZZY, '', $translation ); |
356 | 409 | $flags[] = 'fuzzy'; |
— | — | @@ -421,11 +474,16 @@ |
422 | 475 | } |
423 | 476 | } |
424 | 477 | |
| 478 | +/** |
| 479 | + * @todo Needs documentation. |
| 480 | + */ |
425 | 481 | class TranslateTasks { |
426 | 482 | public static function getTasks( $pageTranslation = false ) { |
427 | 483 | global $wgTranslateTasks, $wgTranslateTranslationServices; |
428 | 484 | |
429 | | - // Tasks not to be available in page translation |
| 485 | + /** |
| 486 | + * Tasks not to be available in page translation. |
| 487 | + */ |
430 | 488 | $filterTasks = array( |
431 | 489 | 'optional', |
432 | 490 | 'untranslatedoptional', |
Index: trunk/extensions/Translate/Translate.i18n.php |
— | — | @@ -2,6 +2,7 @@ |
3 | 3 | /** |
4 | 4 | * Translations of Translate extension. |
5 | 5 | * |
| 6 | + * @file |
6 | 7 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
7 | 8 | */ |
8 | 9 | |
Index: trunk/extensions/Translate/TranslateUtils.php |
— | — | @@ -2,6 +2,7 @@ |
3 | 3 | /** |
4 | 4 | * This class contains some static helper functions for other classes. |
5 | 5 | * |
| 6 | + * @file |
6 | 7 | * @author Niklas Laxström |
7 | 8 | * @copyright Copyright © 2007, 2009 Niklas Laxström |
8 | 9 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
— | — | @@ -20,7 +21,9 @@ |
21 | 22 | public static function title( $message, $code ) { |
22 | 23 | global $wgContLang; |
23 | 24 | |
24 | | - // Cache some amount of titles for speed |
| 25 | + /** |
| 26 | + * Cache some amount of titles for speed. |
| 27 | + */ |
25 | 28 | static $cache = array(); |
26 | 29 | if ( !isset( $cache[$message] ) ) { |
27 | 30 | $cache[$message] = $wgContLang->ucfirst( $message ); |
— | — | @@ -96,7 +99,6 @@ |
97 | 100 | $recentchanges = $dbr->tableName( 'recentchanges' ); |
98 | 101 | $hours = intval( $hours ); |
99 | 102 | $cutoff_unixtime = time() - ( $hours * 3600 ); |
100 | | - # $cutoff_unixtime = $cutoff_unixtime - ($cutoff_unixtime % 86400); |
101 | 103 | $cutoff = $dbr->timestamp( $cutoff_unixtime ); |
102 | 104 | |
103 | 105 | $namespaces = $dbr->makeList( $wgTranslateMessageNamespaces ); |
— | — | @@ -111,7 +113,9 @@ |
112 | 114 | |
113 | 115 | $res = $dbr->query( $sql, __METHOD__ ); |
114 | 116 | |
115 | | - // Fetch results, prepare a batch link existence check query |
| 117 | + /** |
| 118 | + * Fetch results, prepare a batch link existence check query. |
| 119 | + */ |
116 | 120 | $rows = array(); |
117 | 121 | while ( $row = $dbr->fetchObject( $res ) ) { |
118 | 122 | $rows[] = $row; |
— | — | @@ -152,13 +156,23 @@ |
153 | 157 | $suffix = ''; |
154 | 158 | |
155 | 159 | $parts1 = isset( $parts[1] ) ? $parts[1] : ''; |
| 160 | + |
| 161 | + /** |
| 162 | + * @todo Add missing scripts that are in use (deva, arab). |
| 163 | + */ |
156 | 164 | switch ( $parts1 ) { |
157 | 165 | case 'latn': |
158 | | - $suffix = ' (Latin)'; # TODO: i18n |
| 166 | + /** |
| 167 | + * @todo i18n. |
| 168 | + */ |
| 169 | + $suffix = ' (Latin)'; |
159 | 170 | unset( $parts[1] ); |
160 | 171 | break; |
161 | 172 | case 'cyrl': |
162 | | - $suffix = ' (Cyrillic)'; # TODO: i18n |
| 173 | + /** |
| 174 | + * @todo i18n. |
| 175 | + */ |
| 176 | + $suffix = ' (Cyrillic)'; |
163 | 177 | unset( $parts[1] ); |
164 | 178 | break; |
165 | 179 | } |
— | — | @@ -194,7 +208,9 @@ |
195 | 209 | self::messageIndex(); |
196 | 210 | } |
197 | 211 | |
198 | | - # Performance hotspot |
| 212 | + /** |
| 213 | + * Performance hotspot. |
| 214 | + */ |
199 | 215 | # $normkey = self::normaliseKey( $namespace, $key ); |
200 | 216 | $normkey = str_replace( " ", "_", strtolower( "$namespace:$key" ) ); |
201 | 217 | |
— | — | @@ -211,7 +227,9 @@ |
212 | 228 | self::messageIndex(); |
213 | 229 | } |
214 | 230 | |
215 | | - # Performance hotspot |
| 231 | + /** |
| 232 | + * Performance hotspot. |
| 233 | + */ |
216 | 234 | # $normkey = self::normaliseKey( $namespace, $key ); |
217 | 235 | $normkey = str_replace( " ", "_", strtolower( "$namespace:$key" ) ); |
218 | 236 | |
Index: trunk/extensions/Translate/SpecialMagic.php |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Returns HTML5 output of the form |
52 | | - * GLOBALS: $wgLang |
| 52 | + * GLOBALS: $wgLang, $wgScript |
53 | 53 | */ |
54 | 54 | protected function getForm() { |
55 | 55 | global $wgLang, $wgScript; |
— | — | @@ -127,7 +127,7 @@ |
128 | 128 | |
129 | 129 | /** |
130 | 130 | * The special page running code |
131 | | - * GLOBALS: $wgRequest, $wgOut, $wgUser, $wgLang |
| 131 | + * GLOBALS: $wgRequest, $wgOut, $wgUser |
132 | 132 | */ |
133 | 133 | public function execute( $parameters ) { |
134 | 134 | global $wgUser, $wgOut, $wgRequest; |
Index: trunk/extensions/Translate/SpecialTranslations.php |
— | — | @@ -5,8 +5,7 @@ |
6 | 6 | * |
7 | 7 | * @author Siebrand Mazeland |
8 | 8 | * @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 |
11 | 10 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
12 | 11 | */ |
13 | 12 | |
— | — | @@ -41,7 +40,9 @@ |
42 | 41 | return; |
43 | 42 | } |
44 | 43 | |
45 | | - # GET values |
| 44 | + /** |
| 45 | + * GET values. |
| 46 | + */ |
46 | 47 | $message = $wgRequest->getText( 'message' ); |
47 | 48 | $namespace = $wgRequest->getInt( 'namespace', NS_MAIN ); |
48 | 49 | if ( $message !== '' ) { |
— | — | @@ -142,7 +143,9 @@ |
143 | 144 | return; |
144 | 145 | } |
145 | 146 | |
146 | | - // Normal output |
| 147 | + /** |
| 148 | + * Normal output. |
| 149 | + */ |
147 | 150 | $titles = array(); |
148 | 151 | |
149 | 152 | foreach ( $res as $s ) { |
— | — | @@ -160,7 +163,9 @@ |
161 | 164 | $tableheader .= Xml::element( 'th', null, wfMsg( 'allmessagescurrent' ) ); |
162 | 165 | $tableheader .= Xml::closeElement( 'tr' ); |
163 | 166 | |
164 | | - // Adapted version of TranslateUtils:makeListing() by Nikerabbit |
| 167 | + /** |
| 168 | + * Adapted version of TranslateUtils:makeListing() by Nikerabbit. |
| 169 | + */ |
165 | 170 | $out = $tableheader; |
166 | 171 | |
167 | 172 | $canTranslate = $wgUser->isAllowed( 'translate' ); |
— | — | @@ -237,7 +242,9 @@ |
238 | 243 | $wgOut->addScriptFile( TranslateUtils::assetPath( 'js/jquery.form.js' ) ); |
239 | 244 | $wgOut->addExtensionStyle( TranslateUtils::assetPath( 'js/base/custom-theme/jquery-ui-1.7.2.custom.css' ) ); |
240 | 245 | |
241 | | - // Might be needed, but ajax doesn't load it |
| 246 | + /** |
| 247 | + * Might be needed, but ajax does not load it. |
| 248 | + */ |
242 | 249 | $diff = new DifferenceEngine; |
243 | 250 | $diff->showDiffStyle(); |
244 | 251 | } |
Index: trunk/extensions/Translate/Translate.alias.php |
— | — | @@ -2,6 +2,7 @@ |
3 | 3 | /** |
4 | 4 | * Aliases for special pages of Translate extension. |
5 | 5 | * |
| 6 | + * @file |
6 | 7 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
7 | 8 | */ |
8 | 9 | |