function wfShowingResults( $offset, $limit )
{
- return wfMsg( "showingresults", $limit, $offset+1 );
+ global $wgLang;
+ return wfMsg( "showingresults", $wgLang->formatNum( $limit ), $wgLang->formatNum( $offset+1 ) );
}
function wfShowingResultsNum( $offset, $limit, $num )
{
- return wfMsg( "showingresultsnum", $limit, $offset+1, $num );
+ global $wgLang;
+ return wfMsg( "showingresultsnum", $wgLang->formatNum( $limit ), $wgLang->formatNum( $offset+1 ), $wgLang->formatNum( $num ) );
}
function wfViewPrevNext( $offset, $limit, $link, $query = "", $atend = false )
{
- global $wgUser;
- $prev = wfMsg( "prevn", $limit );
- $next = wfMsg( "nextn", $limit );
+ global $wgUser, $wgLang;
+ $fmtLimit = $wgLang->formatNum( $limit );
+ $prev = wfMsg( "prevn", $fmtLimit );
+ $next = wfMsg( "nextn", $fmtLimit );
$link = wfUrlencode( $link );
$sk = $wgUser->getSkin();
function wfNumLink( $offset, $limit, $link, $query = "" )
{
- global $wgUser;
+ global $wgUser, $wgLang;
if ( "" == $query ) { $q = ""; }
else { $q = "{$query}&"; }
$q .= "limit={$limit}&offset={$offset}";
- $s = "<a href=\"" . wfLocalUrlE( $link, $q ) . "\">{$limit}</a>";
+ $fmtLimit = $wgLang->formatNum( $limit );
+ $s = "<a href=\"" . wfLocalUrlE( $link, $q ) . "\">{$fmtLimit}</a>";
return $s;
}
if ( $wgDisableCounters ) {
$s = "";
} else {
- $count = $wgArticle->getCount();
+ $count = $wgLang->formatNum( $wgArticle->getCount() );
$s = wfMsg( "viewcount", $count );
}
$s .= $this->lastModified();
if ( 0 == $limit ) {
$lt = wfMsg( "all" );
} else {
- $lt = "${limit}";
+ $lt = $wgLang->formatNum( "${limit}" );
$sql .= " LIMIT {$limit}";
}
$wgOut->addHTML( "<p>" . wfMsg( "imglegend" ) . "\n" );
if ( ! $first ) { $fill .= " | "; }
$first = false;
- $fill .= $sk->makeKnownLink( $here, "{$num}",
+ $fill .= $sk->makeKnownLink( $here, $wgLang->formatNum( $num ),
"sort=bysize&limit={$num}" );
}
$text = wfMsg( "showlast", $fill, $bysize );
if ( ! $first ) { $fill .= " | "; }
$first = false;
- $fill .= $sk->makeKnownLink( $here, $num,
+ $fill .= $sk->makeKnownLink( $here, $wgLang->formatNum( $num ),
"sort=bydate&limit={$num}" );
}
$text = wfMsg( "showlast", $fill, $bydate );
$ilink = "<a href=\"" . wfImageUrl( $name ) .
"\">{$name}</a>";
- $nb = wfMsg( "nbytes", $s->img_size );
+ $nb = wfMsg( "nbytes", $wgLang->formatNum( $s->img_size ) );
$l = "(" .
$sk->makeKnownLink( $wgLang->getNsText(
Namespace::getImage() ) . ":{$name}", wfMsg( "imgdesc" ) ) .
}
function formatResult( $skin, $result ) {
- $nb = wfMsg( "nbytes", $result->len );
+ global $wgLang;
+ $nb = wfMsg( "nbytes", $wgLang->formatNum( $result->len ) );
$link = $skin->makeKnownLink( $result->cur_title, "" );
return "{$link} ({$nb})";
}
}
function formatResult( $skin, $result ) {
-
global $wgLang;
$u = $result->cur_user;
$ut = $result->cur_user_text;
- $length = wfmsg( "nbytes", $result->cur_length );
+ $length = wfmsg( "nbytes", $wgLang->formatNum( $result->cur_length ) );
$c = wfEscapeHTML( $result->cur_comment );
if ( 0 == $u ) { # not by a logged-in user
}
function formatResult( $skin, $result ) {
+ global $wgLang;
$link = $skin->makeKnownLink( $result->cur_title, "" );
- $nv = wfMsg( "nviews", $result->cur_counter );
+ $nv = wfMsg( "nviews", $wgLang->formatNum( $result->cur_counter ) );
return "{$link} ({$nv})";
}
}
}
if(isset($from)) {
- $note = wfMsg( "rcnotefrom", $limit,
+ $note = wfMsg( "rcnotefrom", $wgLang->formatNum( $limit ),
$wgLang->timeanddate( $from, true ) );
} else {
- $note = wfMsg( "rcnote", $limit, $days );
+ $note = wfMsg( "rcnote", $wgLang->formatNum( $limit ), $wgLang->formatNum( $days ) );
}
$wgOut->addHTML( "\n<hr>\n{$note}\n<br>" );
global $wgUser, $wgLang;
$sk = $wgUser->getSkin();
$s = $sk->makeKnownLink( $wgLang->specialPage( $page ),
- ($lim ? "{$lim}" : wfMsg( "all" ) ), "{$more}" .
+ ($lim ? $wgLang->formatNum( "{$lim}" ) : wfMsg( "all" ) ), "{$more}" .
($d ? "days={$d}&" : "") . "limit={$lim}" );
return $s;
}
global $wgUser, $wgLang;
$sk = $wgUser->getSkin();
$s = $sk->makeKnownLink( $wgLang->specialPage( $page ),
- ($d ? "{$d}" : wfMsg( "all" ) ), "{$more}days={$d}" .
+ ($d ? $wgLang->formatNum( "{$d}" ) : wfMsg( "all" ) ), "{$more}days={$d}" .
($lim ? "&limit={$lim}" : "") );
return $s;
}
}
function formatResult( $skin, $result ) {
- $nb = wfMsg( "nbytes", $result->len );
+ global $wgLang;
+ $nb = wfMsg( "nbytes", $wgLang->formatNum( $result->len ) );
$link = $skin->makeKnownLink( $result->cur_title, "" );
return "{$link} ({$nb})";
}
function wfSpecialStatistics()
{
- global $wgUser, $wgOut;
+ global $wgUser, $wgOut, $wgLang;
$fname = "wfSpecialStatistics";
$wgOut->addHTML( "<h2>" . wfMsg( "sitestats" ) . "</h2>\n" );
$good = $row->ss_good_articles;
$text = wfMsg( "sitestatstext",
- $total, $good, $views, $edits,
- sprintf( "%.2f", $total ? $edits / $total : 0 ),
- sprintf( "%.2f", $edits ? $views / $edits : 0 ) );
+ $wgLang->formatNum( $total ),
+ $wgLang->formatNum( $good ),
+ $wgLang->formatNum( $views ),
+ $wgLang->formatNum( $edits ),
+ $wgLang->formatNum( sprintf( "%.2f", $total ? $edits / $total : 0 ) ),
+ $wgLang->formatNum( sprintf( "%.2f", $edits ? $views / $edits : 0 ) ) );
$wgOut->addHTML( $text );
$wgOut->addHTML( "<h2>" . wfMsg( "userstats" ) . "</h2>\n" );
$sk = $wgUser->getSkin();
$ap = $sk->makeKnownLink( wfMsg( "administrators" ), "" );
- $text = wfMsg( "userstatstext", $total, $admins, $ap );
+ $text = wfMsg( "userstatstext",
+ $wgLang->formatNum( $total ),
+ $wgLang->formatNum( $admins ), $ap );
$wgOut->addHTML( $text );
}
}
if(isset($_REQUEST['magic'])) {
- $wgOut->addHTML( wfMsg( "watchlistcontains", $nitems ) .
+ $wgOut->addHTML( wfMsg( "watchlistcontains", $wgLang->formatNum( $nitems ) ) .
"<p>" . wfMsg( "watcheditlist" ) . "</p>\n" );
$wgOut->addHTML( "<form action='" .
}
- $wgOut->addHTML( "<i>" . wfMsg( "watchdetails", $nitems, $npages, $y,
+ $wgOut->addHTML( "<i>" . wfMsg( "watchdetails",
+ $wgLang->formatNum( $nitems ), $wgLang->formatNum( $npages ), $y,
$specialTitle->getURL( "magic=yes", true ) ) . "</i><br>\n" );
$res = wfQuery( $sql, DB_READ, $fname );
if($days >= 1)
- $note = wfMsg( "rcnote", $limit, $days );
+ $note = wfMsg( "rcnote", $wgLang->formatNum( $limit ), $wgLang->formatNum( $days ) );
elseif($days > 0)
- $note = wfMsg( "wlnote", $limit, round($days*24) );
+ $note = wfMsg( "wlnote", $wgLang->formatNum( $limit ), $wgLang->formatNum( round($days*24) ) );
else
$note = "";
$wgOut->addHTML( "\n<hr>\n{$note}\n<br>" );
$sk = $wgUser->getSkin();
$s = $sk->makeKnownLink(
$wgLang->specialPage( $page ),
- $h, "days=" . ($h / 24.0) );
+ $wgLang->formatNum( $h ),
+ "days=" . ($h / 24.0) );
return $s;
}
$sk = $wgUser->getSkin();
$s = $sk->makeKnownLink(
$wgLang->specialPage( $page ),
- ($d ? $d : wfMsg( "all" ) ), "days=$d" );
+ ($d ? $wgLang->formatNum( $d ) : wfMsg( "all" ) ), "days=$d" );
return $s;
}
$datePreference = $wgAmericanDates ? 1 : 2;
}
- if ( $datePreference == 1 ) {
- # MDY
- $d = $this->getMonthAbbreviation( substr( $ts, 4, 2 ) ) .
- " " . (0 + substr( $ts, 6, 2 )) . ", " .
- substr( $ts, 0, 4 );
- } else if ( $datePreference == 2 ) {
- #DMY
- $d = (0 + substr( $ts, 6, 2 )) . " " .
- $this->getMonthAbbreviation( substr( $ts, 4, 2 ) ) . " " .
- substr( $ts, 0, 4 );
- } else {
- #YMD
- $d = substr( $ts, 0, 4 ) . " " . $this->getMonthAbbreviation( substr( $ts, 4, 2 ) ) .
- " " . (0 + substr( $ts, 6, 2 ));
+ $month = $this->getMonthAbbreviation( substr( $ts, 4, 2 ) );
+ $day = $this->formatNum( 0 + substr( $ts, 6, 2 ) );
+ $year = $this->formatNum( substr( $ts, 0, 4 ) );
+
+ switch( $datePreference ) {
+ case 1: return "$month $day, $year";
+ case 2: return "$day $month $year";
+ default: return "$year $month $day";
}
-
- return $d;
}
function time( $ts, $adj = false )
if ( $adj ) { $ts = $this->userAdjust( $ts ); }
$t = substr( $ts, 8, 2 ) . ":" . substr( $ts, 10, 2 );
- return $t;
+ return $this->formatNum( $t );
}
function timeanddate( $ts, $adj = false )
{
return NULL;
}
+
+ # Normally we use the plain ASCII digits. Some languages such as Arabic will
+ # want to output numbers using script-appropriate characters: override this
+ # function with a translator. See LanguageAr.php for an example.
+ function formatNum( $number ) {
+ return $number;
+ }
}
include_once("LanguageUtf8.php");
/* private */ $wgNamespaceNamesAr = array(
- "-2" => "ملف",
- "-1" => "خاص",
- "0" => "",
- "1" => "نقاش",
- "2" => "مستخدم",
- "3" => "نقاش_المستخدم",
- "4" => "ويكيبيديا",
- "5" => "ويكيبيديا_نقاش",
- "6" => "صورة",
- "7" => "نقاش_الصورة",
- "8" => "MediaWiki",
- "9" => "MediaWiki_talk",
+ -2 => "ملف",
+ -1 => "خاص",
+ 0 => "",
+ 1 => "نقاش",
+ 2 => "مستخدم",
+ 3 => "نقاش_المستخدم",
+ 4 => "ويكيبيديا",
+ 5 => "ويكيبيديا_نقاش",
+ 6 => "صورة",
+ 7 => "نقاش_الصورة",
+ 8 => "MediaWiki",
+ 9 => "MediaWiki_talk",
);
/* private */ $wgWeekdayNamesAr = array(
);
class LanguageAr extends LanguageUtf8 {
+ var $digitTransTable = array(
+ "0" => "٠",
+ "1" => "١",
+ "2" => "٢",
+ "3" => "٣",
+ "4" => "٤",
+ "5" => "٥",
+ "6" => "٦",
+ "7" => "٧",
+ "8" => "٨",
+ "9" => "٩",
+ "%" => "٪",
+ "." => "٫",
+ "," => "٬"
+ );
+
# TODO: TRANSLATION!
# Inherit everything except...
return $s;
}
-
+
+ function formatNum( $number ) {
+ return strtr( $number, $this->digitTransTable );
+ }
}
?>