r111087 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111086‎ | r111087 | r111088 >
Date:20:51, 9 February 2012
Author:robin
Status:ok
Tags:
Comment:
IncubatorTest: Redirect $redlink=1 back to the normal page also for sister projects
InfoPage: a better title for unrecognised languages: put "unknown code" after the title instead of using it as parameter
Modified paths:
  • /trunk/extensions/WikimediaIncubator/IncubatorTest.php (modified) (history)
  • /trunk/extensions/WikimediaIncubator/InfoPage.i18n.php (modified) (history)
  • /trunk/extensions/WikimediaIncubator/InfoPage.php (modified) (history)
  • /trunk/extensions/WikimediaIncubator/WikimediaIncubator.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikimediaIncubator/WikimediaIncubator.php
@@ -16,7 +16,7 @@
1717 'path' => __FILE__,
1818 'name' => 'Wikimedia Incubator',
1919 'author' => 'SPQRobin',
20 - 'version' => '4.6',
 20+ 'version' => '4.7',
2121 'url' => '//www.mediawiki.org/wiki/Extension:WikimediaIncubator',
2222 'descriptionmsg' => 'wminc-desc',
2323 );
Index: trunk/extensions/WikimediaIncubator/IncubatorTest.php
@@ -540,23 +540,27 @@
541541 }
542542
543543 /**
544 - * When creating a new info page, help the user by prefilling it
 544+ * - Redirect action=edit&redlink=1 to the normal page
 545+ * - When creating a new info page, help the user by prefilling it
545546 * @return True
546547 */
547548 public static function onEditFormPreloadText( &$text, &$title ) {
548549 $pagetitle = $title->getText();
549 - $prefix = IncubatorTest::analyzePrefix( $pagetitle, true /* only info page */ );
 550+ $prefix = IncubatorTest::analyzePrefix( $pagetitle, true /* only info page */, true /* also sister projects */ );
550551 if( $prefix['error'] || $title->getNamespace() != NS_MAIN ) {
551552 return true;
552553 }
553 - global $wgRequest, $wgOut;
 554+ global $wgRequest, $wgOut, $wmincSisterProjects;
554555 if ( $wgRequest->getBool( 'redlink' ) ) {
555556 # The edit page was reached via a red link.
556557 # Redirect to the article page and let them click the edit tab if
557558 # they really want to create this info page.
558559 $wgOut->redirect( $title->getFullUrl() );
559560 }
560 - $text = wfMsgNoTrans( 'wminc-infopage-prefill', $prefix['prefix'] );
 561+ # Prefill when &action=edit, but not for sister projects
 562+ if( !array_key_exists( $prefix['project'], $wmincSisterProjects ) ) {
 563+ $text = wfMessage( 'wminc-infopage-prefill', $prefix['prefix'] )->plain();
 564+ }
561565 return true;
562566 }
563567
Index: trunk/extensions/WikimediaIncubator/InfoPage.i18n.php
@@ -12,7 +12,7 @@
1313 */
1414 $messages['en'] = array(
1515 'wminc-infopage-enter' => 'go to the Main Page',
16 - 'wminc-unknownlang' => '(unknown language with code "$1")',
 16+ 'wminc-unknownlang' => '(unknown language code)',
1717 'wminc-logo-wikipedia' => 'Wikipedia-logo-v2-en.svg', # only translate if necessary
1818 'wminc-logo-wiktionary' => 'Wiktionary-logo-en.svg', # only translate if necessary
1919 'wminc-logo-wikibooks' => 'Wikibooks-logo-en-noslogan.svg', # only translate if necessary
Index: trunk/extensions/WikimediaIncubator/InfoPage.php
@@ -42,9 +42,14 @@
4343 $this->mSubStatus = '';
4444 $this->mThisLangData = array( 'type' => 'valid' ); # For later code check feature
4545 $this->mLangNames = IncubatorTest::getLanguageNames();
46 - $this->mLangName = ( isset( $this->mLangNames[$this->mLangCode] ) ?
47 - $this->mLangNames[$this->mLangCode] : wfMsg( 'wminc-unknownlang', $this->mLangCode ) );
48 - $this->mFormatTitle = wfMsgHtml( 'wminc-infopage-title-' . $this->mProjectCode, $this->mLangName );
 46+ $this->mLangName = isset( $this->mLangNames[$this->mLangCode] ) ?
 47+ $this->mLangNames[$this->mLangCode] : null;
 48+ $titleParam = $this->mLangName ? $this->mLangName : '"' . $this->mLangCode . '"'; # Name, else code
 49+ $this->mFormatTitle = wfMessage( 'wminc-infopage-title-' . $this->mProjectCode, $titleParam )->escaped();
 50+ if( !$this->mLangName ) {
 51+ # Unknown language, add short note to title
 52+ $this->mFormatTitle .= ' ' . wfMessage( 'wminc-unknownlang', $this->mLangCode )->escaped();
 53+ }
4954 return;
5055 }
5156

Status & tagging log