From dca65c9c510c60ee2a288d8076e5728dce88c20a Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 9 Feb 2009 17:48:41 +0000 Subject: [PATCH] (bug 7509) Separation strings should be configurable Last commit to fix this issue. Related commits are r47028, r47040, r47044. Originally committed as r40953, which was reverted in r40977, because if was too verbose. Language::pipeList, and Language::commaList should have resolved that. --- RELEASE-NOTES | 1 + includes/WatchlistEditor.php | 8 ++++++-- includes/specials/SpecialAllmessages.php | 16 +++++++++++----- includes/specials/SpecialAllpages.php | 8 ++++---- includes/specials/SpecialBlockip.php | 4 ++-- includes/specials/SpecialContributions.php | 2 +- includes/specials/SpecialNewpages.php | 4 ++-- includes/specials/SpecialPreferences.php | 2 +- includes/specials/SpecialPrefixindex.php | 15 +++++++++------ includes/specials/SpecialRecentchanges.php | 6 +++--- includes/specials/SpecialUserlogin.php | 4 +++- includes/specials/SpecialWatchlist.php | 8 +++++--- includes/specials/SpecialWhatlinkshere.php | 2 +- 13 files changed, 49 insertions(+), 31 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index cb58432e62..84e3753662 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -154,6 +154,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 17190) User ID on preference page no longer has delimeters * (bug 17341) "Powered by MediaWiki" should be on the left on RTL wikis * (bug 17404) "userrights-interwiki" right was missing in User::$mCoreRights +* (bug 7509) Separation strings should be configurable == API changes in 1.15 == * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions diff --git a/includes/WatchlistEditor.php b/includes/WatchlistEditor.php index e49851bdaf..82f62f6aaa 100644 --- a/includes/WatchlistEditor.php +++ b/includes/WatchlistEditor.php @@ -407,6 +407,8 @@ class WatchlistEditor { * @return string */ private function buildRemoveLine( $title, $redirect, $skin ) { + global $wgLang; + $link = $skin->makeLinkObj( $title ); if( $redirect ) $link = '' . $link . ''; @@ -419,7 +421,7 @@ class WatchlistEditor { } return "
  • " . Xml::check( 'titles[]', false, array( 'value' => $title->getPrefixedText() ) ) - . $link . " (" . implode( ' | ', $tools ) . ")" . "
  • \n"; + . $link . " (" . $wgLang->pipeList( $tools ) . ")" . "\n"; } /** @@ -480,11 +482,13 @@ class WatchlistEditor { * @return string */ public static function buildTools( $skin ) { + global $wgLang; + $tools = array(); $modes = array( 'view' => false, 'edit' => 'edit', 'raw' => 'raw' ); foreach( $modes as $mode => $subpage ) { $tools[] = $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Watchlist', $subpage ), wfMsgHtml( "watchlisttools-{$mode}" ) ); } - return implode( ' | ', $tools ); + return $wgLang->pipeList( $tools ); } } diff --git a/includes/specials/SpecialAllmessages.php b/includes/specials/SpecialAllmessages.php index 0ff94b493e..38181c0827 100644 --- a/includes/specials/SpecialAllmessages.php +++ b/includes/specials/SpecialAllmessages.php @@ -10,7 +10,7 @@ */ function wfSpecialAllmessages() { global $wgOut, $wgRequest, $wgMessageCache, $wgTitle; - global $wgUseDatabaseMessages; + global $wgUseDatabaseMessages, $wgLang; # The page isn't much use if the MediaWiki namespace is not being used if( !$wgUseDatabaseMessages ) { @@ -49,16 +49,22 @@ function wfSpecialAllmessages() { $wgOut->addScriptFile( 'allmessages.js' ); if ( $ot == 'php' ) { $navText .= wfAllMessagesMakePhp( $messages ); - $wgOut->addHTML( 'PHP | HTML | ' . + $wgOut->addHTML( $wgLang->pipeList( array( + 'PHP', + 'HTML', 'XML' . - '
    ' . htmlspecialchars( $navText ) . '
    ' ); + '
    ' . htmlspecialchars( $navText ) . '
    ' + ) ) ); } else if ( $ot == 'xml' ) { $wgOut->disable(); header( 'Content-type: text/xml' ); echo wfAllMessagesMakeXml( $messages ); } else { - $wgOut->addHTML( 'PHP | ' . - 'HTML | XML' ); + $wgOut->addHTML( $wgLang->pipeList( array( + 'PHP', + 'HTML', + 'XML' + ) ) ); $wgOut->addWikiText( $navText ); $wgOut->addHTML( wfAllMessagesMakeHTMLText( $messages ) ); } diff --git a/includes/specials/SpecialAllpages.php b/includes/specials/SpecialAllpages.php index 5da23f202d..c6c1ca3d19 100644 --- a/includes/specials/SpecialAllpages.php +++ b/includes/specials/SpecialAllpages.php @@ -257,7 +257,7 @@ class SpecialAllpages extends IncludableSpecialPage { * @param string $to list all pages to this name (default FALSE) */ function showChunk( $namespace = NS_MAIN, $from = false, $to = false ) { - global $wgOut, $wgUser, $wgContLang; + global $wgOut, $wgUser, $wgContLang, $wgLang; $sk = $wgUser->getSkin(); @@ -382,7 +382,7 @@ class SpecialAllpages extends IncludableSpecialPage { . ( $namespace ? '&namespace=' . $namespace : '' ); $prevLink = $sk->makeKnownLinkObj( $self, wfMsgHTML( 'prevpage', htmlspecialchars( $pt ) ), $q ); - $out2 .= ' | ' . $prevLink; + $out2 = $wgLang->pipeList( array( $out2, $prevLink ) ); } if( $n == $this->maxPerPage && $s = $res->fetchObject() ) { @@ -392,7 +392,7 @@ class SpecialAllpages extends IncludableSpecialPage { . ( $namespace ? '&namespace=' . $namespace : '' ); $nextLink = $sk->makeKnownLinkObj( $self, wfMsgHtml( 'nextpage', htmlspecialchars( $t->getText() ) ), $q ); - $out2 .= ' | ' . $nextLink; + $out2 = $wgLang->pipeList( array( $out2, $nextLink ) ); } $out2 .= ""; } @@ -404,7 +404,7 @@ class SpecialAllpages extends IncludableSpecialPage { $wgOut->addHTML( $prevLink ); } if( isset( $prevLink ) && isset( $nextLink ) ) { - $wgOut->addHTML( ' | ' ); + $wgOut->addHTML( wfMsgExt( 'pipe-separator' , 'escapenoentities' ) ); } if( isset( $nextLink ) ) { $wgOut->addHTML( $nextLink ); diff --git a/includes/specials/SpecialBlockip.php b/includes/specials/SpecialBlockip.php index da51d90849..5dabd9778e 100644 --- a/includes/specials/SpecialBlockip.php +++ b/includes/specials/SpecialBlockip.php @@ -526,14 +526,14 @@ class IPBlockForm { * @return string */ private function getConvenienceLinks() { - global $wgUser; + global $wgUser, $wgLang; $skin = $wgUser->getSkin(); if( $this->BlockAddress ) $links[] = $this->getContribsLink( $skin ); $links[] = $this->getUnblockLink( $skin ); $links[] = $this->getBlockListLink( $skin ); $links[] = $skin->makeLink ( 'MediaWiki:Ipbreason-dropdown', wfMsgHtml( 'ipb-edit-dropdown' ) ); - return ''; + return ''; } /** diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 2fb01f52ee..84ece2a0f2 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -190,7 +190,7 @@ class SpecialContributions extends SpecialPage { wfRunHooks( 'ContributionsToolLinks', array( $id, $nt, &$tools ) ); - $links = implode( ' | ', $tools ); + $links = $wgLang->pipeList( $tools ); } // Old message 'contribsub' had one parameter, but that doesn't work for diff --git a/includes/specials/SpecialNewpages.php b/includes/specials/SpecialNewpages.php index 597d43a674..9cf71777a3 100644 --- a/includes/specials/SpecialNewpages.php +++ b/includes/specials/SpecialNewpages.php @@ -122,7 +122,7 @@ class SpecialNewpages extends SpecialPage { } protected function filterLinks() { - global $wgGroupPermissions, $wgUser; + global $wgGroupPermissions, $wgUser, $wgLang; // show/hide links $showhide = array( wfMsgHtml( 'show' ), wfMsgHtml( 'hide' ) ); @@ -155,7 +155,7 @@ class SpecialNewpages extends SpecialPage { $links[$key] = wfMsgHtml( $msg, $link ); } - return implode( ' | ', $links ); + return $wgLang->pipeList( $links ); } protected function form() { diff --git a/includes/specials/SpecialPreferences.php b/includes/specials/SpecialPreferences.php index b83beb830e..5b7e954df3 100644 --- a/includes/specials/SpecialPreferences.php +++ b/includes/specials/SpecialPreferences.php @@ -679,7 +679,7 @@ class PreferencesForm { $this->tableRow( wfMsgExt( 'prefs-memberingroups', array( 'parseinline' ), count( $userEffectiveGroupsArray ) ), $wgLang->commaList( $userEffectiveGroupsArray ) . - '
    (' . implode( ' | ', $toolLinks ) . ')' + '
    (' . $wgLang->pipeList( $toolLinks ) . ')' ) . $this->tableRow( diff --git a/includes/specials/SpecialPrefixindex.php b/includes/specials/SpecialPrefixindex.php index 1572e3fea3..3ed4d15d37 100644 --- a/includes/specials/SpecialPrefixindex.php +++ b/includes/specials/SpecialPrefixindex.php @@ -90,7 +90,7 @@ class SpecialPrefixindex extends SpecialAllpages { * @param string $from list all pages from this name (default FALSE) */ function showPrefixChunk( $namespace = NS_MAIN, $prefix, $from = null ) { - global $wgOut, $wgUser, $wgContLang; + global $wgOut, $wgUser, $wgContLang, $wgLang; $sk = $wgUser->getSkin(); @@ -175,11 +175,14 @@ class SpecialPrefixindex extends SpecialAllpages { wfMsg ( 'allpages' ) ); if( isset( $res ) && $res && ( $n == $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) { $namespaceparam = $namespace ? "&namespace=$namespace" : ""; - $out2 .= " | " . $sk->makeKnownLinkObj( - $self, - wfMsgHtml( 'nextpage', htmlspecialchars( $s->page_title ) ), - "from=" . wfUrlEncode( $s->page_title ) . - "&prefix=" . wfUrlEncode( $prefix ) . $namespaceparam ); + $out2 = $wgLang->pipeList( array( + $out2, + $sk->makeKnownLinkObj( + $self, + wfMsgHtml( 'nextpage', htmlspecialchars( $s->page_title ) ), + "from=" . wfUrlEncode( $s->page_title ) . + "&prefix=" . wfUrlEncode( $prefix ) . $namespaceparam ) + ) ); } $out2 .= ""; } diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 83f6949f58..2fd7fe4a10 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -622,14 +622,14 @@ class SpecialRecentChanges extends SpecialPage { $cl[] = $this->makeOptionsLink( $wgLang->formatNum( $value ), array( 'limit' => $value ), $nondefaults, $value == $options['limit'] ) ; } - $cl = implode( ' | ', $cl ); + $cl = $wgLang->pipeList( $cl ); // day links, reset 'from' to none foreach( $wgRCLinkDays as $value ) { $dl[] = $this->makeOptionsLink( $wgLang->formatNum( $value ), array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] ) ; } - $dl = implode( ' | ', $dl ); + $dl = $wgLang->pipeList( $dl ); // show/hide links @@ -654,7 +654,7 @@ class SpecialRecentChanges extends SpecialPage { if( $wgUser->useRCPatrol() ) $links[] = wfMsgHtml( 'rcshowhidepatr', $patrLink ); $links[] = wfMsgHtml( 'rcshowhidemine', $myselfLink ); - $hl = implode( ' | ', $links ); + $hl = $wgLang->pipeList( $links ); // show from this onward link $now = $wgLang->timeanddate( wfTimestampNow(), true ); diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index 1bb54ed62f..650654ee1e 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -969,6 +969,8 @@ class LoginForm { * @return string */ function makeLanguageSelector() { + global $wgLang; + $msg = wfMsgForContent( 'loginlanguagelinks' ); if( $msg != '' && !wfEmptyMsg( 'loginlanguagelinks', $msg ) ) { $langs = explode( "\n", $msg ); @@ -980,7 +982,7 @@ class LoginForm { $links[] = $this->makeLanguageSelectorLink( $parts[0], $parts[1] ); } } - return count( $links ) > 0 ? wfMsgHtml( 'loginlanguagelabel', implode( ' | ', $links ) ) : ''; + return count( $links ) > 0 ? wfMsgHtml( 'loginlanguagelabel', $wgLang->pipeList( $links ) ) : ''; } else { return ''; } diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index 91ab38e36d..c62919bc54 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -286,7 +286,7 @@ function wfSpecialWatchlist( $par ) { # Namespace filter and put the whole form together. $form .= $wlInfo; $form .= $cutofflinks; - $form .= implode( ' | ', $links ); + $form .= $wgLang->pipeList( $links ); $form .= Xml::openElement( 'form', array( 'method' => 'post', 'action' => $thisTitle->getLocalUrl() ) ); $form .= '

    '; $form .= Xml::label( wfMsg( 'namespace' ), 'namespace' ) . ' '; @@ -389,6 +389,8 @@ function wlDaysLink( $d, $page, $options = array() ) { * Returns html */ function wlCutoffLinks( $days, $page = 'Watchlist', $options = array() ) { + global $wgLang; + $hours = array( 1, 2, 6, 12 ); $days = array( 1, 3, 7 ); $i = 0; @@ -401,8 +403,8 @@ function wlCutoffLinks( $days, $page = 'Watchlist', $options = array() ) { } return wfMsgExt('wlshowlast', array('parseinline', 'replaceafter'), - implode(' | ', $hours), - implode(' | ', $days), + $wgLang->pipeList( $hours ), + $wgLang->pipeList( $days ), wlDaysLink( 0, $page, $options ) ); } diff --git a/includes/specials/SpecialWhatlinkshere.php b/includes/specials/SpecialWhatlinkshere.php index d91b496095..0902489470 100644 --- a/includes/specials/SpecialWhatlinkshere.php +++ b/includes/specials/SpecialWhatlinkshere.php @@ -340,7 +340,7 @@ class WhatLinksHerePage { $limitLinks[] = $this->makeSelfLink( $prettyLimit, wfArrayToCGI( $overrides, $changed ) ); } - $nums = implode ( ' | ', $limitLinks ); + $nums = $wgLang->pipeList( $limitLinks ); return wfMsgHtml( 'viewprevnext', $prev, $next, $nums ); } -- 2.20.1