From 7d86589f975e93861c69a60260149e9a742fb8b4 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Sat, 24 Jun 2006 21:43:34 +0000 Subject: [PATCH] * (bug 5852) Localise "number of watching users" according to user locale --- RELEASE-NOTES | 1 + includes/ChangesList.php | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 9e37d62414..f2e313c4b7 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -560,6 +560,7 @@ Some default configuration options have changed: * (bug 5903) When requesting the raw source of a non-existent message page, return blank content (as opposed to the message key) * Improve default blank content of MediaWiki:Common.css and MediaWiki:Monobook.css +* (bug 5852) Localise "number of watching users" according to user locale == Compatibility == diff --git a/includes/ChangesList.php b/includes/ChangesList.php index b2c1abe243..8e3b607cfd 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -213,6 +213,16 @@ class ChangesList { return( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) ); } + /** + * Format a number according to the user's locale + * + * @param $number Number to format + * @return string + */ + function formatNum( $number ) { + global $wgLang; + return $wgLang->formatNum( $number ); + } } @@ -225,7 +235,6 @@ class OldChangesList extends ChangesList { * Format a line using the old system (aka without any javascript). */ function recentChangesLine( &$rc, $watched = false ) { - global $wgContLang; $fname = 'ChangesList::recentChangesLineOld'; wfProfileIn( $fname ); @@ -268,7 +277,7 @@ class OldChangesList extends ChangesList { $this->insertComment($s, $rc); if($rc->numberofWatchingusers > 0) { - $s .= ' ' . wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($rc->numberofWatchingusers)); + $s .= ' ' . wfMsg('number_of_watching_users_RCview', $this->formatNum( $rc->numberofWatchingusers ) ); } $s .= "\n"; @@ -473,8 +482,7 @@ class EnhancedChangesList extends ChangesList { $r .= $users; if($block[0]->numberofWatchingusers > 0) { - global $wgContLang; - $r .= wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($block[0]->numberofWatchingusers)); + $r .= wfMsg('number_of_watching_users_RCview', $this->formatNum($block[0]->numberofWatchingusers)); } $r .= "
\n"; @@ -575,7 +583,6 @@ class EnhancedChangesList extends ChangesList { * @return string a HTML formated line (generated using $r) */ function recentChangesBlockLine( $rcObj ) { - global $wgContLang; # Get rc_xxxx variables extract( $rcObj->mAttribs ); @@ -614,7 +621,7 @@ class EnhancedChangesList extends ChangesList { } if( $rcObj->numberofWatchingusers > 0 ) { - $r .= wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($rcObj->numberofWatchingusers)); + $r .= wfMsg('number_of_watching_users_RCview', $this->formatNum( $rcObj->numberofWatchingusers ) ); } $r .= "
\n"; -- 2.20.1