Opened 5 years ago
Closed 5 years ago
#5606 closed defect (bug) (fixed)
i18n formatting breaks dashboard count
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 2.5 |
| Component: | Administration | Version: | 2.5 |
| Severity: | normal | Keywords: | has-patch needs-testing |
| Cc: |
Description (last modified by lloydbudd)
I have 1812 posts in my blog, but my dashboard is reporting that I have "1 posts". I added the following code to wp-admin/index.php immediately after the $num_posts line:
echo $num_posts;
echo ngettext( '%d post', '%d posts', $num_posts);
echo number_format_i18n($num_posts);
echo sprintf('%d posts', '1,812');
The answers were:
1812
%d posts
1,812
1 posts
So, it appears that that comma makes sprintf unhappy.
Attachments (1)
Change History (12)
comment:1
sarekofvulcan — 5 years ago
comment:2
sarekofvulcan — 5 years ago
*headdesk* You get the idea, right?
comment:4
sarekofvulcan — 5 years ago
Thanks, lloydbudd.
I'm attaching a diff: it fixes the post count, but none of my other counts are high enough to properly test the others.
comment:5
sarekofvulcan — 5 years ago
- Keywords has-patch added
comment:6
sarekofvulcan — 5 years ago
- Keywords needs-testing added
comment:7
follow-up:
↓ 8
nbachiyski — 5 years ago
The patch forks for me, I have a sample install with lots of 'em.
comment:8
in reply to:
↑ 7
sarekofvulcan — 5 years ago
Replying to nbachiyski:
The patch forks for me, I have a sample install with lots of 'em.
*is confused* Is that a typo for "works"?
comment:9
nbachiyski — 5 years ago
Yes, I meant works.
comment:10
ryan — 5 years ago
- Owner changed from anonymous to ryan
comment:11
ryan — 5 years ago
- Resolution set to fixed
- Status changed from new to closed
Already fixed.

Well, there were line breaks in there before... Just for clarity, that's
{{{echo $num_posts;
echo ngettext( '%d post', '%d posts', $num_posts);
echo number_format_i18n($num_posts);
echo sprintf('%d posts', '1,812');}}}
and
{{{1812
%d posts
1,812
1 posts}}}