r107338 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107337‎ | r107338 | r107339 >
Date:19:55, 26 December 2011
Author:nikerabbit
Status:ok (Comments)
Tags:
Comment:
Bugfixes
Modified paths:
  • /trunk/extensions/Translate/TranslateHooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/TranslateHooks.php
@@ -331,8 +331,9 @@
332332 /**
333333 * Hook: ParserFirstCallInit
334334 */
335 - public static function translationDialogMagicWord( Parser $parser, $title = '' ) {
 335+ public static function translationDialogMagicWord( Parser $parser, $title = '', $linktext = '' ) {
336336 $title = Title::newFromText( $title );
 337+ if ( !$title ) return '';
337338 $handle = new MessageHandle( $title );
338339 $group = $handle->getGroup();
339340 $callParams = array( $title->getPrefixedText(), $group->getId() );
@@ -348,7 +349,10 @@
349350 'onclick' => $js,
350351 );
351352
352 - $output = Html::element( 'a', $a, wfMessage( 'translate-edit-jsopen' )->text() );
 353+ if ( $linktext === '' ) {
 354+ $linktext = wfMessage( 'translate-edit-jsopen' )->text();
 355+ }
 356+ $output = Html::element( 'a', $a, $linktext );
353357 return $parser->insertStripItem( $output, $parser->mStripState );
354358 }
355359

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r107336Adding POC {{#translationdialog:title}} functionality.nikerabbit19:44, 26 December 2011

Comments

#Comment by Santhosh.thottingal (talk | contribs)   04:49, 29 December 2011

This function is not a ParserFirstCallInit hook. So function documentation need to be corrected.

#Comment by Nikerabbit (talk | contribs)   06:07, 29 December 2011

Good catch.

Status & tagging log