r66825 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66824‎ | r66825 | r66826 >
Date:13:16, 24 May 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Fixed few bugs in page translation

* At some point we started getting integer revisions numbers from Title class
* Always load diff styles on message table because it might be needed
Modified paths:
  • /trunk/extensions/Translate/PageTranslation.i18n.php (modified) (history)
  • /trunk/extensions/Translate/tag/SpecialPageTranslation.php (modified) (history)
  • /trunk/extensions/Translate/tag/TPParse.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/tag/SpecialPageTranslation.php
@@ -15,14 +15,13 @@
1616 }
1717
1818 public function execute( $parameters ) {
19 - wfLoadExtensionMessages( 'PageTranslation' );
2019 $this->setHeaders();
2120
2221 global $wgRequest, $wgOut, $wgUser;
2322 $this->user = $wgUser;
2423
2524 $target = $wgRequest->getText( 'target', $parameters );
26 - $revision = $wgRequest->getText( 'revision', 0 );
 25+ $revision = $wgRequest->getInt( 'revision', 0 );
2726
2827 // No specific page or invalid input
2928 $title = Title::newFromText( $target );
@@ -42,24 +41,27 @@
4342 }
4443
4544 // We are processing some specific page
46 - if ( $revision === '0' ) {
 45+ if ( !$title->exists() ) {
 46+ $wgOut->addWikiMsg( 'tpt-nosuchpage', $title->getPrefixedText() );
 47+ return;
 48+ }
 49+
 50+ if ( $revision === 0 ) {
4751 // Get the latest revision
4852 $revision = $title->getLatestRevID();
49 - } elseif ( $revision !== $title->getLatestRevID() ) {
50 - // We do want to notify the reviewer if the underlying page changes during review
51 - $wgOut->addWikiMsg( 'tpt-oldrevision', $title->getPrefixedText(), $revision );
52 - $this->listPages();
53 - return;
5453 }
55 -
5654 $page = TranslatablePage::newFromRevision( $title, $revision );
57 -
5855 if ( !$page instanceof TranslatablePage ) {
5956 $wgOut->addWikiMsg( 'tpt-notsuitable', $title->getPrefixedText(), $revision );
60 - $this->listPages();
6157 return;
6258 }
6359
 60+ if ( $revision !== $title->getLatestRevID() ) {
 61+ // We do want to notify the reviewer if the underlying page changes during review
 62+ $wgOut->addWikiMsg( 'tpt-oldrevision', $title->getPrefixedText(), $revision );
 63+ return;
 64+ }
 65+
6466 $lastrev = $page->getMarkedTag();
6567 if ( $lastrev !== false && $lastrev === $revision ) {
6668 $wgOut->addWikiMsg( 'tpt-already-marked' );
Index: trunk/extensions/Translate/tag/TPParse.php
@@ -89,7 +89,7 @@
9090
9191 $res = $db->select( $tables, $vars, $conds, __METHOD__ );
9292 foreach ( $res as $r ) {
93 - $section = new TPsection;
 93+ $section = new TPSection;
9494 $section->id = $r->trs_key;
9595 $section->text = $r->trs_text;
9696 $section->type = 'db';
Index: trunk/extensions/Translate/PageTranslation.i18n.php
@@ -31,6 +31,7 @@
3232
3333 # Specific page on the special page
3434 'tpt-badtitle' => 'Page name given ($1) is not a valid title',
 35+ 'tpt-nosuchpage' => 'Page $1 does not exist',
3536 'tpt-oldrevision' => '$2 is not the latest version of the page [[$1]].
3637 Only latest versions can be marked for translation.',
3738 'tpt-notsuitable' => 'Page $1 is not suitable for translation.
@@ -2458,9 +2459,6 @@
24592460 'tpt-install' => 'Запустите php-скрипт maintenance/update.php или веб-установку, чтобы включить возможность перевода страниц.',
24602461 'tpt-render-summary' => 'Обновление для соответствия новой версии исходной страницы.',
24612462 'tpt-download-page' => 'Экспортировать страницу с переводами',
2462 - 'pt-shake-multiple' => 'Несколько маркеров раздела в одном разделе.
2463 -Текст раздела:
2464 -$1',
24652463 );
24662464
24672465 /** Rusyn (русиньскый язык)

Status & tagging log