From fe9cd7ef73347e316cf32fbe47522762581a548a Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Tue, 28 Feb 2012 12:41:26 +0000 Subject: [PATCH] (bug 34702) More localised parentheses. --- includes/RecentChange.php | 1 + includes/SkinLegacy.php | 10 ++++---- includes/logging/LogEventsList.php | 32 +++++++++++++----------- includes/logging/LogPage.php | 5 ++-- includes/specials/SpecialAllmessages.php | 2 +- includes/specials/SpecialListusers.php | 6 +++-- includes/specials/SpecialTags.php | 8 ++++-- includes/specials/SpecialUndelete.php | 6 ++--- includes/specials/SpecialUserlogin.php | 2 +- 9 files changed, 41 insertions(+), 31 deletions(-) diff --git a/includes/RecentChange.php b/includes/RecentChange.php index bb5580833e..73c5299b15 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -706,6 +706,7 @@ class RecentChange { } elseif($szdiff >= 0) { $szdiff = '+' . $szdiff ; } + // @todo i18n with parentheses in content language? $szdiff = '(' . $szdiff . ')' ; } else { $szdiff = ''; diff --git a/includes/SkinLegacy.php b/includes/SkinLegacy.php index eb637d79de..7cdd0a079b 100644 --- a/includes/SkinLegacy.php +++ b/includes/SkinLegacy.php @@ -702,7 +702,7 @@ class LegacyTemplate extends BaseTemplate { global $wgOut; if ( !$wgOut->isArticleRelated() ) { - return '(' . wfMsg( 'notanarticle' ) . ')'; + return wfMessage( 'parentheses', wfMessage( 'notanarticle' )->text() )->escaped(); } else { return Linker::linkKnown( SpecialPage::getTitleFor( 'Recentchangeslinked', $this->getSkin()->getTitle()->getPrefixedDBkey() ), @@ -815,8 +815,9 @@ class LegacyTemplate extends BaseTemplate { $talkLink = Linker::link( $wgUser->getTalkPage(), $wgLang->getNsText( NS_TALK ) ); + $talkLink = wfMessage( 'parentheses' )->rawParams( $talkLink )->escaped(); - $ret .= "$name ($talkLink)"; + $ret .= "$name $talkLink"; } else { $ret .= wfMsg( 'notloggedin' ); } @@ -837,10 +838,11 @@ class LegacyTemplate extends BaseTemplate { } else { $talkLink = Linker::link( $wgUser->getTalkPage(), $wgLang->getNsText( NS_TALK ) ); + $talkLink = wfMessage( 'parentheses' )->rawParams( $talkLink )->escaped(); $ret .= Linker::link( $wgUser->getUserPage(), htmlspecialchars( $wgUser->getName() ) ); - $ret .= " ($talkLink)
"; + $ret .= " $talkLink
"; $ret .= $wgLang->pipeList( array( Linker::link( SpecialPage::getTitleFor( 'Userlogout' ), wfMsg( 'logout' ), @@ -860,6 +862,4 @@ class LegacyTemplate extends BaseTemplate { return $ret; } - } - diff --git a/includes/logging/LogEventsList.php b/includes/logging/LogEventsList.php index 8ff4678126..eccbcdbed9 100644 --- a/includes/logging/LogEventsList.php +++ b/includes/logging/LogEventsList.php @@ -383,7 +383,7 @@ class LogEventsList { if( self::typeAction( $row, 'move', 'move', 'move' ) && !empty( $paramArray[0] ) ) { $destTitle = Title::newFromText( $paramArray[0] ); if( $destTitle ) { - $revert = '(' . Linker::link( + $revert = Linker::link( SpecialPage::getTitleFor( 'Movepage' ), $this->message['revertmove'], array(), @@ -394,7 +394,8 @@ class LogEventsList { 'wpMovetalk' => 0 ), array( 'known', 'noclasses' ) - ) . ')'; + ); + $revert = wfMessage( 'parentheses' )->rawParams( $revert )->escaped(); } // Show undelete link } elseif( self::typeAction( $row, array( 'delete', 'suppress' ), 'delete', 'deletedhistory' ) ) { @@ -403,17 +404,17 @@ class LogEventsList { } else { $viewdeleted = $this->message['undeletelink']; } - $revert = '(' . Linker::link( + $revert = Linker::link( SpecialPage::getTitleFor( 'Undelete' ), $viewdeleted, array(), array( 'target' => $title->getPrefixedDBkey() ), array( 'known', 'noclasses' ) - ) . ')'; + ); + $revert = wfMessage( 'parentheses' )->rawParams( $revert )->escaped(); // Show unblock/change block link } elseif( self::typeAction( $row, array( 'block', 'suppress' ), array( 'block', 'reblock' ), 'block' ) ) { - $revert = '(' . - Linker::link( + $revert = Linker::link( SpecialPage::getTitleFor( 'Unblock', $row->log_title ), $this->message['unblocklink'], array(), @@ -427,12 +428,11 @@ class LogEventsList { array(), array(), 'known' - ) . - ')'; + ); + $revert = wfMessage( 'parentheses' )->rawParams( $revert )->escaped(); // Show change protection link } elseif( self::typeAction( $row, 'protect', array( 'modify', 'protect', 'unprotect' ) ) ) { - $revert .= ' (' . - Linker::link( $title, + $revert .= Linker::link( $title, $this->message['hist'], array(), array( @@ -448,10 +448,10 @@ class LogEventsList { array( 'action' => 'protect' ), 'known' ); } - $revert .= ')'; + $revert = ' ' . wfMessage( 'parentheses' )->rawParams( $revert )->escaped(); // Show unmerge link } elseif( self::typeAction( $row, 'merge', 'merge', 'mergehistory' ) ) { - $revert = '(' . Linker::link( + $revert = Linker::link( SpecialPage::getTitleFor( 'MergeHistory' ), $this->message['revertmerge'], array(), @@ -461,7 +461,8 @@ class LogEventsList { 'mergepoint' => $paramArray[1] ), array( 'known', 'noclasses' ) - ) . ')'; + ); + $revert = wfMessage( 'parentheses' )->rawParams( $revert )->escaped(); // If an edit was hidden from a page give a review link to the history } elseif( self::typeAction( $row, array( 'delete', 'suppress' ), 'revision', 'deletedhistory' ) ) { $revert = RevisionDeleter::getLogLinks( $title, $paramArray, @@ -473,7 +474,7 @@ class LogEventsList { // $paramArray[1] is a CSV of the IDs $query = $paramArray[0]; // Link to each hidden object ID, $paramArray[1] is the url param - $revert = '(' . Linker::link( + $revert = Linker::link( $revdel, $this->message['revdel-restore'], array(), @@ -483,7 +484,8 @@ class LogEventsList { 'ids' => $query ), array( 'known', 'noclasses' ) - ) . ')'; + ); + $revert = wfMessage( 'parentheses' )->rawParams( $revert )->escaped(); } // Do nothing. The implementation is handled by the hook modifiying the passed-by-ref parameters. } else { diff --git a/includes/logging/LogPage.php b/includes/logging/LogPage.php index fd440f49a9..51e2684d69 100644 --- a/includes/logging/LogPage.php +++ b/includes/logging/LogPage.php @@ -416,7 +416,8 @@ class LogPage { # Use the language name for log titles, rather than Log/X if( $name == 'Log' ) { - $titleLink = '(' . Linker::link( $title, LogPage::logName( $par ) ) . ')'; + $titleLink = Linker::link( $title, LogPage::logName( $par ) ); + $titleLink = wfMessage( 'parentheses' )->rawParams( $titleLink )->escaped(); } else { $titleLink = Linker::link( $title ); } @@ -551,7 +552,7 @@ class LogPage { for( $i = 0; $i < count( $flags ); $i++ ) { $flags[$i] = self::formatBlockFlag( $flags[$i], $lang ); } - return '(' . $lang->commaList( $flags ) . ')'; + return wfMessage( 'parentheses' )->rawParams( $lang->commaList( $flags ) )->escaped(); } else { return ''; } diff --git a/includes/specials/SpecialAllmessages.php b/includes/specials/SpecialAllmessages.php index 148cd30e0b..27e25bae9d 100644 --- a/includes/specials/SpecialAllmessages.php +++ b/includes/specials/SpecialAllmessages.php @@ -370,7 +370,7 @@ class AllmessagesTablePager extends TablePager { array( 'broken' ) ); } - return $title . ' (' . $talk . ')'; + return $title . $this->msg( 'parentheses' )->rawParams( $talk )->escaped(); case 'am_default' : case 'am_actual' : diff --git a/includes/specials/SpecialListusers.php b/includes/specials/SpecialListusers.php index cddfe017cc..7589c561aa 100644 --- a/includes/specials/SpecialListusers.php +++ b/includes/specials/SpecialListusers.php @@ -158,14 +158,16 @@ class UsersPager extends AlphabeticPager { } $userTalkPage = $userPage->getTalkPage(); - $talk = ' (' . Linker::link( $userTalkPage, wfMessage( 'talkpagelinktext' )->escaped() ) . ')'; + $talk = Linker::link( $userTalkPage, wfMessage( 'talkpagelinktext' )->escaped() ); + $talk = ' ' . wfMessage( 'parentheses' )->rawParams( $talk )->escaped(); $created = ''; # Some rows may be NULL if( $row->creation ) { $d = $lang->date( wfTimestamp( TS_MW, $row->creation ), true ); $t = $lang->time( wfTimestamp( TS_MW, $row->creation ), true ); - $created = ' (' . wfMsgExt( 'usercreated', array( 'parsemag', 'escape' ), $d, $t, $row->user_name ) . ')'; + $created = wfMsgExt( 'usercreated', array( 'parsemag', 'escape' ), $d, $t, $row->user_name ); + $created = ' ' . wfMessage( 'parentheses' )->rawParams( $created )->escaped(); } wfRunHooks( 'SpecialListusersFormatRow', array( &$item, $row ) ); diff --git a/includes/specials/SpecialTags.php b/includes/specials/SpecialTags.php index adfc74412b..0837fc3f7d 100644 --- a/includes/specials/SpecialTags.php +++ b/includes/specials/SpecialTags.php @@ -75,12 +75,16 @@ class SpecialTags extends SpecialPage { $newRow .= Xml::tags( 'td', null, Xml::element( 'tt', null, $tag ) ); $disp = ChangeTags::tagDescription( $tag ); - $disp .= ' (' . Linker::link( Title::makeTitle( NS_MEDIAWIKI, "Tag-$tag" ), wfMsgHtml( 'tags-edit' ) ) . ')'; + $disp .= ' '; + $editLink = Linker::link( Title::makeTitle( NS_MEDIAWIKI, "Tag-$tag" ), wfMsgHtml( 'tags-edit' ) ); + $disp .= $this->msg( 'parentheses' )->rawParams( $editLink )->escaped(); $newRow .= Xml::tags( 'td', null, $disp ); $msg = wfMessage( "tag-$tag-description" ); $desc = !$msg->exists() ? '' : $msg->parse(); - $desc .= ' (' . Linker::link( Title::makeTitle( NS_MEDIAWIKI, "Tag-$tag-description" ), wfMsgHtml( 'tags-edit' ) ) . ')'; + $desc .= ' '; + $editDescLink = Linker::link( Title::makeTitle( NS_MEDIAWIKI, "Tag-$tag-description" ), wfMsgHtml( 'tags-edit' ) ); + $desc .= $this->msg( 'parentheses' )->rawParams( $editDescLink )->escaped(); $newRow .= Xml::tags( 'td', null, $desc ); $hitcount = wfMsgExt( 'tags-hitcount', array( 'parsemag' ), $this->getLanguage()->formatNum( $hitcount ) ); diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index a82902900a..17d4c4b03c 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -1233,9 +1233,9 @@ class SpecialUndelete extends SpecialPage { $pageLink = $this->getLanguage()->userTimeAndDate( $ts, $user ); } $userLink = $this->getFileUser( $file ); - $data = $this->msg( 'widthheight' )->numParams( $row->fa_width, $row->fa_height )->text() . - ' (' . $this->msg( 'nbytes' )->numParams( $row->fa_size )->text() . ')'; - $data = htmlspecialchars( $data ); + $data = $this->msg( 'widthheight' )->numParams( $row->fa_width, $row->fa_height )->text(); + $bytes = $this->msg( 'parentheses' )->rawParams( $this->msg( 'nbytes' )->numParams( $row->fa_size )->text() )->plain(); + $data = htmlspecialchars( $data . ' ' . $bytes ); $comment = $this->getFileComment( $file ); // Add show/hide deletion links if available diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index b44700cbec..fa1713fa6a 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -334,7 +334,7 @@ class LoginForm extends SpecialPage { $ip = $this->getRequest()->getIP(); if ( $currentUser->isDnsBlacklisted( $ip, true /* check $wgProxyWhitelist */ ) ) { - $this->mainLoginForm( $this->msg( 'sorbs_create_account_reason' )->text() . ' (' . htmlspecialchars( $ip ) . ')' ); + $this->mainLoginForm( $this->msg( 'sorbs_create_account_reason' )->text() . ' ' . $this->msg( 'parentheses' )->rawParams( htmlspecialchars( $ip ) )->escaped() ); return false; } -- 2.20.1