WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#5606 closed defect (bug) (fixed)

i18n formatting breaks dashboard count

Reported by: sarekofvulcan Owned by: ryan
Milestone: 2.5 Priority: normal
Severity: normal Version: 2.5
Component: Administration Keywords: has-patch needs-testing
Focuses: 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)

index.diff (2.1 KB) - added by sarekofvulcan 8 years ago.
wp-admin/index.php patch -- %d => %s

Download all attachments as: .zip

Change History (12)

comment:1 @sarekofvulcan8 years ago

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}}}

comment:2 @sarekofvulcan8 years ago

*headdesk* You get the idea, right?

comment:3 @lloydbudd8 years ago

  • Description modified (diff)

comment:4 @sarekofvulcan8 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.

@sarekofvulcan8 years ago

wp-admin/index.php patch -- %d => %s

comment:5 @sarekofvulcan8 years ago

  • Keywords has-patch added

comment:6 @sarekofvulcan8 years ago

  • Keywords needs-testing added

comment:7 follow-up: @nbachiyski8 years ago

The patch forks for me, I have a sample install with lots of 'em.

comment:8 in reply to: ↑ 7 @sarekofvulcan8 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 @nbachiyski8 years ago

Yes, I meant works.

comment:10 @ryan8 years ago

  • Owner changed from anonymous to ryan

comment:11 @ryan7 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Already fixed.

Note: See TracTickets for help on using tickets.