r71933 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71932‎ | r71933 | r71934 >
Date:09:35, 30 August 2010
Author:siebrand
Status:deferred
Tags:
Comment:
Update documentation.
Modified paths:
  • /trunk/extensions/Translate/SpecialManageGroups.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/SpecialManageGroups.php
@@ -1,6 +1,8 @@
22 <?php
33 /**
4 - * @todo Needs documentation.
 4+ * Implements classes for Special:Translate/manage from where file based message
 5+ * groups are be managed.
 6+ *
57 * @ingroup SpecialPage
68 * @author Niklas Laxström
79 * @author Siebrand Mazeland
@@ -9,6 +11,11 @@
1012 */
1113
1214 /**
 15+ * Class for special page Special:Translate/manage. On this special page file
 16+ * based message groups can be managed (FileBasedMessageGroup). This page
 17+ * allows updating of the file cache, import and fuzzy for source language
 18+ * messages, as well as import/update of messages in other languages.
 19+ *
1320 * @todo Needs documentation.
1421 */
1522 class SpecialManageGroups {
@@ -18,6 +25,9 @@
1926 */
2027 protected $processingTime = 30;
2128
 29+ /**
 30+ * Constructor
 31+ */
2232 public function __construct() {
2333 global $wgOut, $wgUser;
2434 $this->out = $wgOut;
@@ -60,9 +70,8 @@
6171 $cache = new MessageGroupCache( $group );
6272 $code = $wgRequest->getText( 'language', 'en' );
6373
64 - /**
65 - * Go to English for undefined codes.
66 - */
 74+
 75+ // Go to English for undefined codes.
6776 $codes = array_keys( Language::getLanguageNames( false ) );
6877 if ( !in_array( $code, $codes ) ) {
6978 $code = 'en';
@@ -116,6 +125,9 @@
117126 }
118127 }
119128
 129+ /**
 130+ * Special:Translate/manage.
 131+ */
120132 public function getTitle() {
121133 return SpecialPage::getTitleFor( 'Translate', 'manage' );
122134 }
@@ -152,9 +164,7 @@
153165 Xml::hidden( 'process', 1 )
154166 );
155167
156 - /**
157 - * BEGIN
158 - */
 168+ // BEGIN
159169 $messages = $group->load( $code );
160170
161171 if ( !$cache->exists() && $code === 'en' ) {
@@ -175,9 +185,7 @@
176186
177187 $changed = array();
178188 foreach ( $messages as $key => $value ) {
179 - /**
180 - * ignored? ignore!
181 - */
 189+ // ignored? ignore!
182190 if ( in_array( $key, $ignoredMessages ) ) {
183191 continue;
184192 }
@@ -191,9 +199,7 @@
192200 $old = str_replace( TRANSLATE_FUZZY, '', $old );
193201 }
194202
195 - /**
196 - * No changes at all, ignore.
197 - */
 203+ // No changes at all, ignore.
198204 if ( $old === $value ) {
199205 continue;
200206 }
@@ -317,9 +323,7 @@
318324 $changed[] = "<li>$message</li></ul>";
319325 $this->out->addHTML( implode( "\n", $changed ) );
320326 } else {
321 - /**
322 - * END
323 - */
 327+ // END
324328 if ( count( $changed ) ) {
325329 if ( $code === 'en' ) {
326330 $this->out->addWikiMsg( 'translate-manage-intro-en' );
@@ -411,10 +415,22 @@
412416 }
413417 }
414418
 419+ /**
 420+ * Reports if processing time for current page has exceeded the set
 421+ * maximum ($processingTime).
 422+ */
415423 protected function checkProcessTime() {
416424 return wfTimestamp() - $this->time >= $this->processingTime;
417425 }
418426
 427+ /**
 428+ * Set a subtitle like "Manage > FreeCol (open source game) > German"
 429+ * based on group and language code. The language part is not shown if
 430+ * it is 'en', and all three possible parts of the subtitle are linked.
 431+ *
 432+ * @param $group Object MessageGroup.
 433+ * @param $code \string Language code.
 434+ */
419435 protected function setSubtitle( $group, $code ) {
420436 global $wgLang;
421437
@@ -430,6 +446,7 @@
431447 array( 'group' => $group->getId() )
432448 );
433449
 450+ // Do not show language part for English.
434451 if ( $code !== 'en' ) {
435452 $links[] = $this->skin->link(
436453 $this->getTitle(),

Status & tagging log