Index: skins/MonoBook.php =================================================================== --- skins/MonoBook.php (revision 14135) +++ skins/MonoBook.php (working copy) @@ -93,7 +93,7 @@
data['sitenotice']) { ?>
html('sitenotice') ?>
-

data['displaytitle']!=""?$this->text('title'):$this->html('title') ?>

+

html('fulltitle') ?>

msg('tagline') ?>

html('subtitle') ?>
Index: includes/CategoryPage.php =================================================================== --- includes/CategoryPage.php (revision 14135) +++ includes/CategoryPage.php (working copy) @@ -58,6 +58,7 @@ */ function doCategoryMagic( $from = '', $until = '' ) { global $wgContLang,$wgUser, $wgCategoryMagicGallery, $wgCategoryPagingLimit; + global $wgInterlanguageTitles, $wgLanguageCode; $fname = 'CategoryPage::doCategoryMagic'; wfProfileIn( $fname ); @@ -81,17 +82,31 @@ $flip = false; } $limit = $wgCategoryPagingLimit; - $res = $dbr->select( - array( 'page', 'categorylinks' ), - array( 'page_title', 'page_namespace', 'page_len', 'cl_sortkey' ), - array( $pageCondition, - 'cl_from = page_id', - 'cl_to' => $this->mTitle->getDBKey()), - #'page_is_redirect' => 0), - #+ $pageCondition, - $fname, - array( 'ORDER BY' => $flip ? 'cl_sortkey DESC' : 'cl_sortkey', - 'LIMIT' => $limit + 1 ) ); + + if ( $wgInterlanguageTitles ) { + $sql= 'SELECT page_title, page_namespace, page_len, cl_sortkey, ll_title + FROM ' . $dbr->tableName( 'page' ) . ' + INNER JOIN ' . $dbr->tableName( 'categorylinks' ) . ' ON cl_from = page_id + LEFT JOIN ' . $dbr->tableName( 'langlinks' ) . ' ON ll_from = page_id AND ll_lang = ' . $dbr->addQuotes( $wgLanguageCode ) . ' + WHERE cl_to = ' . $dbr->addQuotes( $this->mTitle->getDBKey() ) . ' + ' . /* AND page_is_redirect = 0 */ ' + ORDER BY ' . ( $flip ? 'cl_sortkey DESC' : 'cl_sortkey' ) . ' + LIMIT ' . ( $limit + 1 ) . ' + '; + + $res = $dbr->query( $sql, $fname ); + } else { + $res = $dbr->select( array( 'page', 'categorylinks' ), + array( 'page_title', 'page_namespace', 'page_len', 'cl_sortkey' ), + array( $pageCondition, + 'cl_from = page_id', + 'cl_to' => $this->mTitle->getDBKey()), + #'page_is_redirect' => 0), + #+ $pageCondition, + $fname, + array( 'ORDER BY' => $flip ? 'cl_sortkey DESC' : 'cl_sortkey', + 'LIMIT' => $limit + 1 ) ); + } $sk =& $wgUser->getSkin(); $r = "
\n"; @@ -109,7 +124,7 @@ if( $title->getNamespace() == NS_CATEGORY ) { // Subcategory; strip the 'Category' namespace from the link text. - array_push( $children, $sk->makeKnownLinkObj( $title, $wgContLang->convertHtml( $title->getText() ) ) ); + array_push( $children, $sk->makeKnownLinkObj( $title, $sk->composeDisplayTitle( $title->getText(), @$x->ll_title ) ) ); // If there's a link from Category:A to Category:B, the sortkey of the resulting // entry in the categorylinks table is Category:A, not A, which it SHOULD be. @@ -131,7 +146,10 @@ } } else { // Page in this category - array_push( $articles, $sk->makeSizeLinkObj( $x->page_len, $title, $wgContLang->convert( $title->getPrefixedText() ) ) ) ; + $t = $wgContLang->convert( $title->getPrefixedText() ); + if ( $wgInterlanguageTitles ) $t .= $sk->getLocalizedHTMLTitle( $title->getPrefixedText(), @$x->ll_title ); + + array_push( $articles, $sk->makeSizeLinkObj( $x->page_len, $title, $t ) ); array_push( $articles_start_char, $wgContLang->convert( $wgContLang->firstChar( $x->cl_sortkey ) ) ); } } Index: includes/SkinTemplate.php =================================================================== --- includes/SkinTemplate.php (revision 14135) +++ includes/SkinTemplate.php (working copy) @@ -188,6 +188,8 @@ $tpl->set( 'title', $wgOut->getPageTitle() ); $tpl->set( 'pagetitle', $wgOut->getHTMLTitle() ); $tpl->set( 'displaytitle', $wgOut->mPageLinkTitle ); + $tpl->set( 'localtitle', $this->getLocalizedTitle() ); + $tpl->set( 'fulltitle', $this->composeDisplayTitle( $wgOut->getPageTitle(), $this->getLocalizedTitle() ) ); $tpl->setRef( "thispage", $this->thispage ); $subpagestr = $this->subPageSubtitle(); Index: includes/DefaultSettings.php =================================================================== --- includes/DefaultSettings.php (revision 14135) +++ includes/DefaultSettings.php (working copy) @@ -1946,6 +1946,11 @@ $wgAllowDisplayTitle = false ; /** + * EXPERIMENTAL: Show translated titles based on interlanguage-links + */ +$wgInterlanguageTitles = false ; + +/** * Array of usernames which may not be registered or logged in from * Maintenance scripts can still use these */ Index: includes/Skin.php =================================================================== --- includes/Skin.php (revision 14135) +++ includes/Skin.php (working copy) @@ -689,9 +689,61 @@ return $s; } + function composeDisplayTitle( $title, $localTitle ) { + global $wgInterlanguageTitles; + #TODO: the display-title-magic stuff should be merged in here *somehow* + + #TODO: perhaps use wgContLang->convertHtml ?! + $t= htmlspecialchars( $title ); + + if ( $wgInterlanguageTitles ) { + $t .= $this->getLocalizedHTMLTitle( $title, $localTitle ); + } + + return $t; + } + + function getLocalizedHTMLTitle( $title, $localTitle ) { + global $wgInterlanguageTitles, $wgLanguageCode, $wgContLanguageCode; + + if ( $wgInterlanguageTitles + && $wgContLanguageCode == $wgLanguageCode + && $localTitle == $title ) { + $localTitle = ''; + } + + if ( $wgInterlanguageTitles && $localTitle != '' ) { + #TODO: perhaps use wgContLang->convertHtml ?! + return ' [' . htmlspecialchars( $localTitle ) . ']'; + } else { + return ''; + } + } + + function getLocalizedTitle() { + global $wgOut, $wgInterlanguageTitles, $wgLanguageCode; + + if ( !$wgInterlanguageTitles ) return ''; + + $localTitle = ''; + + $langlinks = $wgOut->getLanguageLinks(); + + foreach ( $langlinks as $link ) { + list( $lang, $title ) = explode( ':', $link, 2 ); + + if ( $lang == $wgLanguageCode ) { + $localTitle = $title; + break; + } + } + + return $localTitle; + } + function pageTitle() { global $wgOut; - $s = '

' . htmlspecialchars( $wgOut->getPageTitle() ) . '

'; + $s = '

' . $this->composeDisplayTitle( $wgOut->getPageTitle(), $this->getLocalizedTitle() ) . '

'; return $s; }