Using a new function, Language::getArrow, to check the direction, instead of hard-coding the arrows and the checks; adding direction marks in Special:DoubleRedirects; adding the real arrows (instead of =>) in Special:Disambiguations.

This commit is contained in:
Rotem Liss 2006-08-06 18:08:21 +00:00
parent 7711ce9807
commit 1576102b47
5 changed files with 20 additions and 11 deletions

View file

@ -68,7 +68,7 @@ class BrokenRedirectsPage extends PageQueryPage {
$from = $skin->makeKnownLinkObj( $fromObj ,'', 'redirect=no' );
$edit = $skin->makeBrokenLinkObj( $fromObj , "(".wfMsg("qbedit").")" , 'redirect=no');
$to = $skin->makeBrokenLinkObj( $toObj );
$arr = $wgContLang->isRTL() ? '←' : '→';
$arr = $wgContLang->getArrow();
return "$from $edit $arr $to";
}

View file

@ -23,7 +23,6 @@ class DisambiguationsPage extends PageQueryPage {
global $wgUser;
$sk = $wgUser->getSkin();
#FIXME : probably need to add a backlink to the maintenance page.
return '<p>'.wfMsg('disambiguationstext', $sk->makeKnownLink(wfMsgForContent('disambiguationspage')) )."</p><br />\n";
}
@ -57,14 +56,16 @@ class DisambiguationsPage extends PageQueryPage {
}
function formatResult( $skin, $result ) {
global $wgContLang;
$title = Title::newFromId( $result->value );
$dp = Title::makeTitle( $result->namespace, $result->title );
$from = $skin->makeKnownLinkObj( $title,'');
$edit = $skin->makeBrokenLinkObj( $title, "(".wfMsg("qbedit").")" , 'redirect=no');
$arr = $wgContLang->getArrow();
$to = $skin->makeKnownLinkObj( $dp,'');
return "$from $edit => $to";
return "$from $edit $arr $to";
}
}

View file

@ -87,7 +87,7 @@ class DoubleRedirectsPage extends PageQueryPage {
$edit = $skin->makeBrokenLinkObj( $titleA, "(".wfMsg("qbedit").")" , 'redirect=no');
$linkB = $skin->makeKnownLinkObj( $titleB, '', 'redirect=no' );
$linkC = $skin->makeKnownLinkObj( $titleC );
$arr = $wgContLang->isRTL() ? '&larr;' : '&rarr;';
$arr = $wgContLang->getArrow() . $wgContLang->getDirMark();
return( "{$linkA} {$edit} {$arr} {$linkB} {$arr} {$linkC}" );
}

View file

@ -32,6 +32,7 @@ class ListredirectsPage extends QueryPage {
# Make a link to the redirect itself
$rd_title = Title::makeTitle( $result->namespace, $result->title );
$arr = $wgContLang->getArrow() . $wgContLang->getDirMark();
$rd_link = $skin->makeKnownLinkObj( $rd_title, '', 'redirect=no' );
# Find out where the redirect leads
@ -50,10 +51,6 @@ class ListredirectsPage extends QueryPage {
$targetLink = '*';
}
# Check the language; RTL wikis need a &larr;
$arr = $wgContLang->isRTL() ? ' &larr; ' : ' &rarr; ';
$arr .= $wgContLang->getDirMark();
# Format the whole thing and return it
return( $rd_link . $arr . $targetLink );

View file

@ -884,16 +884,27 @@ class Language {
*
* @return string
*/
function getDirMark() { return $this->isRTL() ? "\xE2\x80\x8F" : "\xE2\x80\x8E"; }
function getDirMark() {
return $this->isRTL() ? "\xE2\x80\x8F" : "\xE2\x80\x8E";
}
/**
* An arrow, depending on the language direction
*
* @return string
*/
function getArrow() {
return $this->isRTL() ? '←' : '→';
}
/**
* To allow "foo[[bar]]" to extend the link over the whole word "foobar"
*
* @return bool
*/
function linkPrefixExtension() {
function linkPrefixExtension() {
$this->load();
return $this->linkPrefixExtension;
return $this->linkPrefixExtension;
}
function &getMagicWords() {