Last modified: 2011-03-13 18:04:46 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}}".
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).
(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.
(including the empty string, by default)
"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.
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.
If Formatnum is intended "for interface messages", then it *must* handle localised formatting. Otherwise it is pointless.
*** Bug 20386 has been marked as a duplicate of this bug. ***
(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.
http://www.mediawiki.org/wiki/Extension:FormatNum