r49772 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49771‎ | r49772 | r49773 >
Date:11:45, 23 April 2009
Author:siebrand
Status:deferred
Tags:
Comment:
* Add a link to Special:Translate for the message group
* update author section
Modified paths:
  • /trunk/extensions/Translate/TranslateEditAddons.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/TranslateEditAddons.php
@@ -5,7 +5,8 @@
66 * Tools for edit page view to aid translators.
77 *
88 * @author Niklas Laxström
9 - * @copyright Copyright © 2007-2008 Niklas Laxström
 9+ * @author Siebrand Mazeland
 10+ * @copyright Copyright © 2007-2009 Niklas Laxström
1011 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1112 */
1213 class TranslateEditAddons {
@@ -133,7 +134,7 @@
134135 return $fallbacks;
135136 }
136137
137 - private static function doBox( $msg, $code, $title = false, $makelink = false ) {
 138+ private static function doBox( $msg, $code, $title = false, $makelink = false, $group = false ) {
138139 global $wgUser, $wgLang;
139140 if ( $msg === null ) { return ''; }
140141
@@ -159,9 +160,17 @@
160161
161162 if( $makelink ) {
162163 $skin = $wgUser->getSkin();
163 - $linkTitle = Title::newFromText( $makelink);
 164+ $linkTitle = Title::newFromText( $makelink );
164165 $title = $skin->makeKnownLinkObj( $linkTitle, $title, 'action=edit' );
165166 }
 167+
 168+ if( $group && $attributes['class'] == 'mw-sp-translate-edit-definition' ) {
 169+ global $wgLang;
 170+
 171+ $skin = $wgUser->getSkin();
 172+ $linkTitle = 'Special:' . SpecialPage::getLocalNameFor( 'Translate' );
 173+ $title = $skin->makeKnownLinkObj( $linkTitle, $title, 'group=' . $group->getId() . '&language=' . $wgLang );
 174+ }
166175 return TranslateUtils::fieldset( $title, Xml::tags( 'code', null, $msg ), $attributes );
167176 }
168177
@@ -287,7 +296,7 @@
288297 // Definition
289298 if ( $en !== null ) {
290299 $label = " ({$group->getLabel()})";
291 - $boxes[] = self::doBox( $en, 'en', wfMsg( self::MSG . 'definition' ) . $label );
 300+ $boxes[] = self::doBox( $en, 'en', wfMsg( self::MSG . 'definition' ) . $label, false, $group );
292301 }
293302
294303
@@ -317,6 +326,4 @@
318327 TranslateUtils::injectCSS();
319328 return Xml::tags( 'div', array( 'class' => 'mw-sp-translate-edit-fields' ), implode( "\n\n", $boxes ) );
320329 }
321 -
322 -
323330 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r49773Follow up on r49772. Committed wrong version.siebrand11:56, 23 April 2009
r49774Another Follow up on r49772. Quotes matter.siebrand12:23, 23 April 2009

Status & tagging log