reddit header: format karma number

In the top-right of every logged-in reddit page, we display the user's link
karma.  This number has been unformatted, which makes it a bit difficult to
read at a glance as you gain a fair amount of karma.  Now we'll format it with
periods or commas, according to the locale.
This commit is contained in:
xiongchiamiov
2015-04-15 14:08:06 -07:00
parent 94f716be69
commit 6ed439233b

View File

@@ -23,7 +23,12 @@
<%!
from pylons import request
from r2.config import feature
from r2.lib.template_helpers import add_sr, display_link_karma, header_url
from r2.lib.template_helpers import (
add_sr,
display_link_karma,
format_number,
header_url,
)
from r2.models import Sub, FakeSubreddit
from r2.models.subreddit import DefaultSR
from r2.lib.pages import SearchForm
@@ -78,7 +83,7 @@
%else:
<span class="user">
${plain_link(c.user.name, "/user/%s/" % c.user.name, _sr_path=False)}
&nbsp;(<span class="userkarma" title="${_("link karma")}">${display_link_karma(c.user.link_karma)}</span>)
&nbsp;(<span class="userkarma" title="${_("link karma")}">${format_number(display_link_karma(c.user.link_karma))}</span>)
</span>
${separator("|")}