r73937 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73936‎ | r73937 | r73938 >
Date:08:07, 29 September 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Code simplification and bug fix (parameter for Special:Translate is language and not code)
Modified paths:
  • /trunk/extensions/Translate/TranslatePage.php (modified) (history)
  • /trunk/extensions/Translate/tag/TranslatablePage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/TranslatePage.php
@@ -253,16 +253,9 @@
254254 protected function taskSelector( $pageTranslation = false ) {
255255 $selector = new HTMLSelector( 'task', 'task', $this->options['task'] );
256256
257 - /**
258 - * Check if this is a page translation group to return only appropriate tasks.
259 - */
260 - $isPageTranslation = false;
261 - if ( $this->group ) {
262 - $isPageTranslation = strpos( $this->group->getId(), 'page|' ) === 0;
263 - }
264 -
 257+ $isPageTranslation = $this->group instanceof WikiPageMessageGroup;
265258 foreach ( TranslateTasks::getTasks( $isPageTranslation ) as $id ) {
266 - $label = call_user_func( array( 'TranslateTask', 'labelForTask' ), $id );
 259+ $label = TranslateTask::labelForTask( $id );
267260 $selector->addOption( $label, $id );
268261 }
269262
Index: trunk/extensions/Translate/tag/TranslatablePage.php
@@ -471,14 +471,11 @@
472472 public function getTranslationUrl( $code = false ) {
473473 $translate = SpecialPage::getTitleFor( 'Translate' );
474474 $params = array(
475 - 'group' => 'page|' . $this->getTitle()->getPrefixedText(),
476 - 'task' => 'view'
 475+ 'group' => $this->getMessageGroupId(),
 476+ 'task' => 'view',
 477+ 'language' => $code,
477478 );
478479
479 - if ( $code ) {
480 - $params['language'] = $code;
481 - }
482 -
483480 return $translate->getFullURL( $params );
484481 }
485482

Status & tagging log