Last modified: 2009-09-01 21:17:50 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 T19659, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 17659 - Change default locale for {{formatnum:}} parser function
Change default locale for {{formatnum:}} parser function
Status: RESOLVED DUPLICATE of bug 13025
Product: MediaWiki
Classification: Unclassified
Internationalization (Other open bugs)
unspecified
All All
: Normal enhancement with 2 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
http://it.wikipedia.org
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-02-24 23:08 UTC by Lenore
Modified: 2009-09-01 21:17 UTC (History)
4 users (show)

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


Attachments

Description Lenore 2009-02-24 23:08:28 UTC
Hi

is possible to change settings in parser function {{formatnum:}} to matching local (italian) conventions, which are different from the default's? In particular, I wish to change decimal separator from the actual dot (.) into comma (,), and digit group separators from the actual comma into   ( ). I hope to have done everything in the correct way

Thanks
Lenore
Comment 1 Lejonel 2009-03-12 21:05:37 UTC
On it.wikipedia it looks like the decimal separator already is ",", and the thousands separator is ".". It should be possible to change $separatorTransformTable in MessagesIt.php to use &thinsp instead.

(Changing component, since formatnum is not in the ParserFunctions extension)

Comment 2 Lenore 2009-03-15 02:00:00 UTC
(In reply to comment #1)
> On it.wikipedia it looks like the decimal separator already is ",", and the
> thousands separator is ".". It should be possible to change
> $separatorTransformTable in MessagesIt.php to use &thinsp instead.
> 
> (Changing component, since formatnum is not in the ParserFunctions extension)
> 
In effect, there's something strange in this function. Some examples

{{formatnum:299792458,56789}} gives 299.792.458.56.789
{{formatnum:299792458.56789}} gives 299.792.458,56789
{{formatnum:299.792.458.56.789|R}} gives 29979245856789
{{formatnum:299.792.458,56789|R}} gives 299792458.56789

it seems to recognize dot as decimal separator and then, effectively, changes it in a comma. Instead it should be (at the moment)

{{formatnum:299792458,56789}} gives 299.792.458,56789

right?
Comment 3 Niklas Laxström 2009-03-15 09:30:37 UTC
Formatnum is designed for formatting numbers in interface elements with correct decimal and thousand separators given a number in PHP's format "12345.12". It cannot be used to prettyprint already formatted numbers. Except if you run them through |R first.
Comment 4 Lenore 2009-03-15 10:51:13 UTC
(In reply to comment #3)
> Formatnum is designed for formatting numbers in interface elements with correct
> decimal and thousand separators given a number in PHP's format "12345.12". It
> cannot be used to prettyprint already formatted numbers. Except if you run them
> through |R first.
> 
Ah, ok. So, it should to be changed thousands separator only; bug reopened
Comment 5 Niklas Laxström 2009-03-15 17:53:39 UTC
(In reply to comment #4)
> Ah, ok. So, it should to be changed thousands separator only

I'm unable to parse that sentence.

Comment 6 Lenore 2009-03-15 21:35:04 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > Ah, ok. So, it should to be changed thousands separator only
> 
> I'm unable to parse that sentence.
> 
Only thousands separator should need to be changed; sorry
Comment 7 Niklas Laxström 2009-04-07 07:07:02 UTC
The CLDR database says that number format for Italian is 12.345,679
Can you provide a reason why this should be changed against the standard?
Comment 8 Lenore 2009-04-07 12:50:30 UTC
(In reply to comment #7)
> The CLDR database says that number format for Italian is 12.345,679
> Can you provide a reason why this should be changed against the standard?
> 

Sure. If you see [[it:Manuale di stile#Cifre e altri caratteri dei numeri|italian manual of style]], you'll see the correct italian form (corretto): 453&#160;340,53 (&#160;=&nbsp;, but I suppose, for graphical convenience, that the use of &thinsp; would be better. Not-breaking space can be included in a template like this <span style="white-space:nowrap">{{formatnum:}}</span>, right?)
Comment 9 Lenore 2009-04-07 12:52:50 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > The CLDR database says that number format for Italian is 12.345,679
> > Can you provide a reason why this should be changed against the standard?
> > 
> 
> Sure. If you see [[it:Manuale di stile#Cifre e altri caratteri dei
> numeri|italian manual of style]], you'll see the correct italian form
> (corretto): 453&#160;340,53 (&#160;=&nbsp;, but I suppose, for graphical
> convenience, that the use of &thinsp; would be better. Not-breaking space can
> be included in a template like this <span
> style="white-space:nowrap">{{formatnum:}}</span>, right?)
> 

Wikilink doesn't work. URL: http://it.wikipedia.org/wiki/Aiuto:Manuale_di_stile#Cifre_e_altri_caratteri_dei_numeri
Comment 10 Niklas Laxström 2009-04-07 13:00:27 UTC
Changing thousand separator for it would affect everything in MediaWiki in all MediaWiki installations. I don't quite buy it that itwiki style guide would take precedence over other standards.
Comment 11 Lenore 2009-04-07 13:14:40 UTC
(In reply to comment #10)
> Changing thousand separator for it would affect everything in MediaWiki in all
> MediaWiki installations. I don't quite buy it that itwiki style guide would
> take precedence over other standards.
> 

Sorry, on meta I read about formatnum (http://meta.wikimedia.org/wiki/Help:Magic_words): "Changes the decimal separator and adds digit group separators (before the decimal separator only) according to the wiki's default locale". From this, I understood that every wiki had its own default for formatnum
Comment 12 Niklas Laxström 2009-04-07 13:35:43 UTC
Indeed, it is only per language. I'll mark this bug as duplicate of 16273, where more flexible number formatting is requested.

*** This bug has been marked as a duplicate of bug 16273 ***
Comment 13 Nemo 2009-09-01 21:17:50 UTC
Bug 16273 has been marked as a duplicate of bug 13025.

*** This bug has been marked as a duplicate of bug 13025 ***

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


Navigation
Links