Last modified: 2011-03-13 18:04:46 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T12454, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 10454 - formatnum: parser function too restrictive, doesn't handle decimals
formatnum: parser function too restrictive, doesn't handle decimals
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
Internationalization (Other open bugs)
unspecified
All All
: Lowest enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
: 20386 (view as bug list)
Depends on: 13025
Blocks:
  Show dependency treegraph
 
Reported: 2007-07-03 18:12 UTC by Daniel U. Thibault
Modified: 2011-03-13 18:04 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Daniel U. Thibault 2007-07-03 18:12:53 UTC
Two separate issues, really. The first is that the formatnum: parser function won't introduce separators as expected in the decimal part. For example, {{formatnum:0.1234567}} should render "0.123,456,7". This may be a localisation issue, and the option to format decimals in this way should at least be offered.

Secondly, formatnum: expects its input in a specific format, which is incongruous once localised. For example, French wikipedia templates that mix formatnum: parameters with non-formatnum: ones will force the user to specify the first with a period, the second with a comma. There should be an option (or an alternate parser function) that expects the input to be already localised, as far as the decimal separator goes.

For example, {{formatnum:123456.789012}} should give "123,456.789,012" under English localisation, "123 456,789 012" under French. But what most French contributors will want to write is "{{formatnum:123456,789012}}".
Comment 1 Dan Wolff 2007-07-16 14:35:02 UTC
If the number is hand written – why use {{formatnum:}}?

At least for Swedish I would expext the decimals to remain as they are (i.e. formatted 123 456,789012).
Comment 2 Aryeh Gregor (not reading bugmail, please e-mail directly) 2007-07-16 15:27:12 UTC
(In reply to comment #0)
> Two separate issues, really. The first is that the formatnum: parser function
> won't introduce separators as expected in the decimal part. For example,
> {{formatnum:0.1234567}} should render "0.123,456,7".

Note that this is not done in English, at least not with commas.  You sometimes see the SI standard of using spaces or thin spaces, though, especially if there are lots of digits.  Maybe we want a separate separator for the decimal part, which can be defined as whatever you like.
Comment 3 Aryeh Gregor (not reading bugmail, please e-mail directly) 2007-07-16 15:36:15 UTC
(including the empty string, by default)
Comment 4 Daniel U. Thibault 2007-07-17 13:04:51 UTC
"If the number is hand written – why use {{formatnum:}}?"

The context from which this issue arose is the French Wikipedia, where formatnum is used within planet and minor solar system object infoboxes. It is expected the infoboxes could be generated semi-automatically (from spreadsheet listings, for example), and the numbers thus obtained need formatting. Right now, the infoboxes are awkward because they include formatted and unformatted parameters, the latter allowing alternate notations to be added (e.g. standard semi-major axes in km, alternates in AUs, etc.). The formatted parameters require a period as decimal separator (that's what formatnum: demands), but the unformatted ones must be written using a comma as decimal separator, because that's how it's done in French. It becomes confusing when one tries to edit the infoboxes.
Comment 5 Niklas Laxström 2009-04-07 08:09:03 UTC
Formatnum is intended for simple number formatting for interface messages, not for complex number formatting in articles etc. and currently there is no need to handle grouping of decimals there. For more complex number formatting you might be better off requesting an extension do this.
Comment 6 Daniel U. Thibault 2009-04-15 12:20:35 UTC
If Formatnum is intended "for interface messages", then it *must* handle localised formatting. Otherwise it is pointless.
Comment 7 Chad H. 2009-08-25 22:46:26 UTC
*** Bug 20386 has been marked as a duplicate of this bug. ***
Comment 8 Nemo 2009-09-01 20:58:16 UTC
(In reply to comment #5)
> Formatnum is intended for simple number formatting for interface messages, not
> for complex number formatting in articles etc. and currently there is no need
> to handle grouping of decimals there. For more complex number formatting you
> might be better off requesting an extension do this.
> 

See bug 13025.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links