r71655 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71654‎ | r71655 | r71656 >
Date:20:00, 25 August 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Documentation updates
Modified paths:
  • /trunk/extensions/Translate/MessageGroups.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/MessageGroups.php
@@ -725,8 +725,13 @@
726726 }
727727
728728 /**
729 - * @todo: needs documentation
730 - * @deprecated
 729+ * Group for messages that can be controlled via a page in MediaWiki namespace.
 730+ *
 731+ * In the page comments start with # and continue till the end of the line.
 732+ * The page should contain list of page names in MediaWiki namespace, without
 733+ * the namespace prefix. Use underscores for spaces in page names, since
 734+ * whitespace separates the page names from each other.
 735+ * @ingroup MessageGroups
731736 */
732737 class WikiMessageGroup extends MessageGroupOld {
733738 protected $source = null;
@@ -745,13 +750,12 @@
746751
747752 /**
748753 * Fetch definitions from database.
 754+ * @return \array Array of messages keys with definitions.
749755 */
750756 public function getDefinitions() {
751757 $definitions = array();
752758
753 - /**
754 - * In theory could have templates that are substitued
755 - */
 759+ // In theory the page could have templates that are substitued
756760 $contents = wfMsg( $this->source );
757761 $contents = preg_replace( '~^\s*#.*$~m', '', $contents );
758762 $messages = preg_split( '/\s+/', $contents );
@@ -773,7 +777,7 @@
774778 *
775779 * @param $key \string Key of the message.
776780 * @param $code \string Language code.
777 - * @todo Document return value (<code>isset( $data[$title][0] ) ? $data[$title][0] : null;<code> from TranslateUtils::getMessageContent).
 781+ * @return \types{\string,\null} The translation or null if it doesn't exists.
778782 */
779783 public function getMessage( $key, $code ) {
780784 global $wgContLang;
@@ -787,8 +791,8 @@
788792 }
789793
790794 /**
791 - * @todo: needs documentation
792 - * @deprecated
 795+ * Wraps the translatable page sections into a message group.
 796+ * @ingroup PageTranslation
793797 */
794798 class WikiPageMessageGroup extends WikiMessageGroup {
795799 protected $title;
@@ -860,7 +864,7 @@
861865 *
862866 * @param $key \string Key of the message.
863867 * @param $code \string Language code.
864 - * @return Mixed Stored translation or null.
 868+ * @return \mixed Stored translation or null.
865869 */
866870 public function getMessage( $key, $code ) {
867871 if ( $code === 'en' ) {
@@ -906,7 +910,8 @@
907911 }
908912
909913 /**
910 - * @todo: needs documentation
 914+ * Factory class for accessing message groups individually by id or
 915+ * all of them as an list.
911916 */
912917 class MessageGroups {
913918 public static function init() {
@@ -936,8 +941,9 @@
937942 }
938943
939944 /**
940 - * Manually reset groups when dependencies cannot
941 - * detect those automatically
 945+ * Manually reset group cache.
 946+ *
 947+ * Use when automatic dependency tracking fails.
942948 */
943949 public static function clearCache() {
944950 $key = wfMemckey( 'translate-groups' );
@@ -1004,9 +1010,7 @@
10051011 if ( !empty( $conf['AUTOLOAD'] ) && is_array( $conf['AUTOLOAD'] ) ) {
10061012 $dir = dirname( $configFile );
10071013 foreach ( $conf['AUTOLOAD'] as $class => $file ) {
1008 - /**
1009 - * For this request and for caching.
1010 - */
 1014+ // For this request and for caching.
10111015 $wgAutoloadClasses[$class] = "$dir/$file";
10121016 $autoload[$class] = "$dir/$file";
10131017 }
@@ -1030,6 +1034,11 @@
10311035 wfDebug( __METHOD__ . "-end\n" );
10321036 }
10331037
 1038+ /**
 1039+ * Fetch a message group by id.
 1040+ * @param $id \string Message group id.
 1041+ * @return Message group or null if it doesn't exist.
 1042+ */
10341043 public static function getGroup( $id ) {
10351044 self::init();
10361045
@@ -1052,9 +1061,7 @@
10531062 } elseif ( strpos( $id, 'page|' ) === 0 ) {
10541063 list( , $title ) = explode( '|', $id, 2 );
10551064
1056 - /**
1057 - * Check first if it valid page title at all.
1058 - */
 1065+ // Check first if it valid page title at all.
10591066 if ( !Title::newFromText( $title ) ) {
10601067 return null;
10611068 }
@@ -1066,6 +1073,7 @@
10671074 }
10681075 }
10691076
 1077+ /// @todo make protected
10701078 public $classes;
10711079 private function __construct() {
10721080 self::init();
@@ -1079,6 +1087,10 @@
10801088 return $instance;
10811089 }
10821090
 1091+ /**
 1092+ * Get all enabled message groups.
 1093+ * @return \array
 1094+ */
10831095 public function getGroups() {
10841096 if ( $this->classes === null ) {
10851097 $this->classes = array();

Status & tagging log