Jack Phoenix has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/389471 )

Change subject: Refactor the top-fans-points i18n message and its use cases a 
bit
......................................................................

Refactor the top-fans-points i18n message and its use cases a bit

Introduces the new i18n message top-fans-points-tag, which is used only in
the <topusers> tag (which is not enabled by default).
Both i18n messages now contain the amount of points as the $1 parameter.

Bug: T158606
Change-Id: I1699db825e7a91bf9e4c73672a2bc9b55a596483
---
M UserStats/TopFansRecent.php
M UserStats/TopUsers.php
M UserStats/TopUsersTag.php
M UserStats/i18n/en.json
4 files changed, 8 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SocialProfile 
refs/changes/71/389471/1

diff --git a/UserStats/TopFansRecent.php b/UserStats/TopFansRecent.php
index b668181..87ddcc9 100644
--- a/UserStats/TopFansRecent.php
+++ b/UserStats/TopFansRecent.php
@@ -176,9 +176,8 @@
                                        '<a href="' . htmlspecialchars( 
$user_title->getFullURL() ) . '" >' . $user['user_name'] . '</a>
                                </span>';
 
-                       $output .= '<span class="top-fan-points"><b>' .
-                               $this->getLanguage()->formatNum( 
$user['points'] ) . '</b> ' .
-                               $this->msg( 'top-fans-points' )->plain() . 
'</span>';
+                       $output .= '<span class="top-fan-points">' .
+                               $this->msg( 'top-fans-points' )->numParams( 
$user['points'] )->text() . '</span>';
                        $output .= '<div class="visualClear"></div>';
                        $output .= '</div>';
                        $x++;
diff --git a/UserStats/TopUsers.php b/UserStats/TopUsers.php
index 30c9e3c..d9b2fb3 100644
--- a/UserStats/TopUsers.php
+++ b/UserStats/TopUsers.php
@@ -167,9 +167,8 @@
                                                $user['user_name'] . '</a>
                                </span>';
 
-                       $output .= '<span class="top-fan-points"><b>' .
-                               number_format( $user['points'] ) . '</b> ' .
-                               $this->msg( 'top-fans-points' )->plain() . 
'</span>';
+                       $output .= '<span class="top-fan-points">' .
+                               $this->msg( 'top-fans-points' )->numParams( 
$user['points'] )->text() . '</span>';
                        $output .= '<div class="visualClear"></div>';
                        $output .= '</div>';
                        $x++;
diff --git a/UserStats/TopUsersTag.php b/UserStats/TopUsersTag.php
index 2f58a46..b2faa0a 100644
--- a/UserStats/TopUsersTag.php
+++ b/UserStats/TopUsersTag.php
@@ -32,8 +32,6 @@
  * @return String: HTML
  */
 function getTopUsersForTag( $input, $args, $parser ) {
-       global $wgLang;
-
        // Don't allow showing OVER 9000...I mean, over 50 users, duh.
        // Performance and all that stuff.
        if (
@@ -66,8 +64,8 @@
                                <span class=\"top-fan-number\">{$x}.</span>
                                <a 
href=\"{$user->getFullURL()}\">{$avatar->getAvatarURL()}</a>
                                <span class=\"top-fans-user\"><a 
href=\"{$user->getFullURL()}\">{$fan['user_name']}</a></span>
-                               <span class=\"top-fans-points\"><b>+" . 
$wgLang->formatNum( $fan['points'] ) . '</b> ' .
-                               wfMessage( 'top-fans-points' )->plain() . 
'</span>
+                               <span class=\"top-fans-points\">" .
+                               wfMessage( 'top-fans-points-tag' )->numParams( 
$fan['points'] )->text() . '</span>
                        </div>';
                $x++;
        }
diff --git a/UserStats/i18n/en.json b/UserStats/i18n/en.json
index f739de5..804c2ff 100644
--- a/UserStats/i18n/en.json
+++ b/UserStats/i18n/en.json
@@ -14,7 +14,8 @@
        "top-fans-total-points-link": "Total points",
        "top-fans-weekly-points-link": "Points this week",
        "top-fans-monthly-points-link": "Points this month",
-       "top-fans-points": "points",
+       "top-fans-points": "'''$1''' points",
+       "top-fans-points-tag": "'''+$1''' points",
        "top-fans-by-category-title-edit-count": "Top overall edits",
        "top-fans-by-category-title-friends-count": "Top overall friends",
        "top-fans-by-category-title-foe-count": "Top overall foes",

-- 
To view, visit https://gerrit.wikimedia.org/r/389471
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1699db825e7a91bf9e4c73672a2bc9b55a596483
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SocialProfile
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to