Ticket #3663 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

ngettext dislikes formatted numbers

Reported by: nbachiyski Assigned to: markjaquith
Priority: normal Milestone: 2.2
Component: Administration Version: 2.1
Severity: normal Keywords: dashboard error ngettext
Cc:

Description

What happens: If the number of comments, posts or cats in the Dashboard is greater than a thousand and the current locale has defined different from default plural rules the <code>ngettext</code>

function spits an error.

Why: The aforementioned numbers are passed through <code>number_format</code> before usage, which adds a coma between digits groups. Thus the number is no more the valid number, <code>ngettext</code> expects.

Solution: Could we sacrifice the formatting of the numbers? If we could the patch below is relevant.

Attachments

gettext-dislikes-formats.diff (0.9 kB) - added by nbachiyski on 01/24/07 21:29:17.
number_format02.diff (2.4 kB) - added by markjaquith on 01/24/07 23:47:53.
Patch for trunk

Change History

01/24/07 21:29:17 changed by nbachiyski

  • attachment gettext-dislikes-formats.diff added.

01/24/07 23:47:53 changed by markjaquith

  • attachment number_format02.diff added.

Patch for trunk

(follow-up: ↓ 2 ) 01/24/07 23:49:53 changed by markjaquith

  • owner changed from anonymous to markjaquith.
  • status changed from new to assigned.

Why can't we pass non-number_format()'d version to ngettext and then use the number_format()'d version in the sprintf() ? See patch.

Also... shouldn't we provide a function like ___number_format() so that translators can provide for a locale's number formatting? For instance, in India they format numbers differently. (open a separate ticket if you agree)

(in reply to: ↑ 1 ) 01/25/07 12:34:12 changed by nbachiyski

Replying to markjaquith:

Why can't we pass non-number_format()'d version to ngettext and then use the number_format()'d version in the sprintf() ? See patch. Also... shouldn't we provide a function like ___number_format() so that translators can provide for a locale's number formatting? For instance, in India they format numbers differently. (open a separate ticket if you agree)

That is why I wanted to remove the formatting. It will be a little burden for translators to dig into number_format options. On the other side it would be nice to have formatted numbers. If you say so, we will arange the things for translators :-)

01/25/07 19:27:28 changed by markjaquith

Well, lets fix the bug first (the sending of formatted numbers to ngettext()) and I'll open a ticket to explore i18n of number formatting.

01/25/07 19:29:33 changed by markjaquith

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [4808]) Do not pass comma-formatted numbers to ngettext(). Props nbachiyski. fixes #3663

01/25/07 19:32:36 changed by markjaquith

#3677 is the ticket for i18n of number_format()

03/03/07 08:14:24 changed by dtc

  • keywords changed from has-patch to dashboard error ngettext.
  • status changed from closed to reopened.
  • version changed from 2.1 to 2.1.2.
  • resolution deleted.

Bug reintroduced in WP 2.1.2.

03/03/07 08:34:14 changed by markjaquith

  • status changed from reopened to closed.
  • version changed from 2.1.2 to 2.1.
  • resolution set to fixed.

Bug was fixed in trunk only, so the fix won't show up in a release version until 2.2 is released in April.