r53166 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53165‎ | r53166 | r53167 >
Date:12:10, 13 July 2009
Author:nikerabbit
Status:ok
Tags:
Comment:
Dig up urls from Configure extension, and if possible add the links to the group descriptions
Modified paths:
  • /trunk/extensions/Translate/MessageGroups.php (modified) (history)
  • /trunk/extensions/Translate/Translate.i18n.php (modified) (history)
  • /trunk/extensions/Translate/groups/MediaWikiExtensions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/MessageGroups.php
@@ -321,7 +321,7 @@
322322 return $wgTranslateExtensionDirectory;
323323 }
324324
325 - public function setDescriptionMsg( $key ) {
 325+ public function setDescriptionMsg( $key, $url ) {
326326 global $wgLang;
327327
328328 $desc = $this->getMessage( $key, $wgLang->getCode() );
@@ -329,6 +329,9 @@
330330 $desc = $this->getMessage( $key, 'en' );
331331 if ( $desc !== null )
332332 $this->description = $desc;
 333+
 334+ if ( $url )
 335+ $this->description .= wfMsgNoTrans( 'translate-ext-url', $url );
333336 }
334337
335338 public static function factory( $label, $id ) {
Index: trunk/extensions/Translate/groups/MediaWikiExtensions.php
@@ -6,6 +6,16 @@
77 public function init() {
88 if ( $this->groups !== null ) return;
99
 10+ global $wgAutoloadClasses, $IP;
 11+ $wgAutoloadClasses['TxtDef'] = "$IP/extensions/Configure/TxtDef.php";
 12+ if ( class_exists( 'TxtDef' ) ) {
 13+ $tmp = TxtDef::loadFromFile( "$IP/extensions/Configure/Configure.settings-ext.txt" );
 14+ $configureData = array_combine( array_map( array( __CLASS__, 'foldId' ), array_keys($tmp)), array_values($tmp) );
 15+ } else {
 16+ $configureData = array();
 17+ }
 18+
 19+
1020 $dir = dirname( __FILE__ );
1121 $defines = file_get_contents( $dir . '/mediawiki-defines.txt' );
1222
@@ -98,10 +108,18 @@
99109 $descmsg = str_replace( 'ext-', '', $id ) . '-desc';
100110 }
101111
 112+ $configureId = self::foldId( $name );
 113+ if ( isset( $configureData[$configureId]['url'] ) ) {
 114+ $url = $configureData[$configureId]['url'];
 115+ } else {
 116+ $url = false;
 117+ }
 118+
102119 $newgroup = array(
103120 'name' => $name,
104121 'file' => $file,
105122 'descmsg' => $descmsg,
 123+ 'url' => $url,
106124 );
107125
108126 $copyvars = array( 'ignored', 'optional', 'var', 'desc', 'prefix', 'mangle' );
@@ -117,6 +135,10 @@
118136 $this->groups = $fixedGroups;
119137 }
120138
 139+ static function foldId( $name ) {
 140+ return preg_replace( '/\s+/', '', strtolower( $name ) );
 141+ }
 142+
121143 public function addAll() {
122144 global $wgTranslateAC, $wgTranslateEC;
123145 $this->init();
@@ -168,7 +190,7 @@
169191 if ( isset( $info['desc'] ) ) {
170192 $group->setDescription( $info['desc'] );
171193 } else {
172 - $group->setDescriptionMsg( $info['descmsg'] );
 194+ $group->setDescriptionMsg( $info['descmsg'], $info['url'] );
173195 }
174196
175197
Index: trunk/extensions/Translate/Translate.i18n.php
@@ -57,6 +57,7 @@
5858
5959 'translate-page-description-legend' => 'Information about the group',
6060 'translate-page-edit' => 'edit',
 61+ 'translate-ext-url' => '<hr />Website: $1',
6162
6263 'translate-optional' => '(optional)',
6364 'translate-ignored' => '(ignored)',

Status & tagging log