Make WordPress Core

Opened 17 years ago

Closed 17 years ago

#5606 closed defect (bug) (fixed)

i18n formatting breaks dashboard count

Reported by: sarekofvulcan's profile sarekofvulcan Owned by: ryan's profile 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 17 years ago.
wp-admin/index.php patch -- %d => %s

Download all attachments as: .zip

Change History (12)

#1 @sarekofvulcan
17 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}}}

#2 @sarekofvulcan
17 years ago

*headdesk* You get the idea, right?

#3 @lloydbudd
17 years ago

  • Description modified (diff)

#4 @sarekofvulcan
17 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.

@sarekofvulcan
17 years ago

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

#5 @sarekofvulcan
17 years ago

  • Keywords has-patch added

#6 @sarekofvulcan
17 years ago

  • Keywords needs-testing added

#7 follow-up: @nbachiyski
17 years ago

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

#8 in reply to: ↑ 7 @sarekofvulcan
17 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"?

#9 @nbachiyski
17 years ago

Yes, I meant works.

#10 @ryan
17 years ago

  • Owner changed from anonymous to ryan

#11 @ryan
17 years ago

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

Already fixed.

Note: See TracTickets for help on using tickets.