Page MenuHomePhabricator

Installation of FormatNum on sl.wiki
Closed, InvalidPublic

Description

Author: smihael

Description:
Could you please enable the FormatNum extension on sl.wikipedia.org?

Unlike English, our language uses commas as decimal mark, which is the main reason we need the extension.

The community agrees on installation; you can find the voting here: http://sl.wikipedia.org/wiki/Wikipedija:Glasovanja/In%C5%A1talacija_Extension:FormatNum

Best regards,
Mihael


Version: unspecified
Severity: enhancement

Details

Reference
bz40386

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 1:02 AM
bzimport set Reference to bz40386.
bzimport added a subscriber: Unknown Object (MLST).

This extension will need review before deployment. fawiki also want it (bug 32311)

If comma vs. decimal is the only reason, then the extension shouldn't be needed because commas and decimals are already marked correctly in MessagesSl.php ($separatorTransformTable). Though iirc formatnum does have some weird behaviour... But improvements to formatnum should go to core imho.

What should be the thousands separator for Slovenian?

smihael wrote:

A dot.

So for example one thousand five hundred forty three point five would be written as: 1.543,5

Reedy added a comment.Oct 12 2012, 5:10 PM

(In reply to comment #2)

If comma vs. decimal is the only reason, then the extension shouldn't be needed
because commas and decimals are already marked correctly in MessagesSl.php
($separatorTransformTable). Though iirc formatnum does have some weird
behaviour... But improvements to formatnum should go to core imho.

(In reply to comment #3)

What should be the thousands separator for Slovenian?

(In reply to comment #4)

A dot.
So for example one thousand five hundred forty three point five would be
written as: 1.543,5

Fixing core localisation stuff should be done first

Sl localisation seems right (since 2010, abb2949d3e10412ea998dc06b39da7f545543c48). See http://sl.wikipedia.org/wiki/Uporabnik:Platonides/Bug_40386

So the requested extension is apparently not needed.

v.pelhan wrote:

If we want to use expr we must transform number into decimal dot system. Problem are numbers bigger than 1000 without thousand dot separator.

Use of extension {{#formatnum:number|number of decimals|decimal separator|thousand separator|old thousand separator}} or {{#formatnum:number|decs=number of decimals|dsep=decimal separator|tsep=thousand separator|otsep=old thousand separator|format=DIN or ISO|mint=minimal number to seperate thousands}} works fine for us (you can check this in http://www.wecowi.de/index.php?title=WeCoWi:Spielwiese)
{{#formatnum: 2300,123|2|.||otsep=.}} → 2300.12
{{#formatnum: 2300|2|.||otsep=.}} → 2300.00
{{#formatnum: 2.300|2|.||otsep=.}} → 2300.00
{{#formatnum: 1.234.567,89|2|.||otsep=.}} → 1234567.89
{{#formatnum: 6,0|2|.||otsep=.}} → 6.00
{{#formatnum: 6,1|2|.||otsep=.}} → 6.10
{{#formatnum: 5|2|.||otsep=.}} → 5.00
{{#formatnum: 10000|2|.||otsep=.}} → 10000.00
{{#formatnum: 10.000|2|.||otsep=.}} → 10000.00
{{#expr: {{#formatnum:10000|2|.||otsep=.}}/{{#formatnum:10|2|.||otsep=.}}}} → 1000
{{#expr: {{#formatnum:6,0|2|.||otsep=.}}/{{#formatnum:2,5|2|.||otsep=.}}}} → 2.4

Current use of formatnum on sl wiki (decimal comma and thousands dot separator):
*{{formatnum: 2300,123}} → 2.300.123 (????)
*{{formatnum: 2300}} → 2.300 (????)
*{{formatnum: 2.300}} → 2,300 (ok)
*{{formatnum: 1.234.567,89}} → 1,234,567.89 (ok)
*{{formatnum: 6,0}} → 6.0 (ok)
*{{formatnum: 6,1}} → 6.1 (ok)
*{{formatnum: 5}} → 5 (ok)
*{{formatnum: 10000}} → 10.000 (????)
*{{formatnum: 10.000}} → 10,000 (ok)
*{{#expr: {{formatnum:10000}}/{{formatnum:10}}}} → 1 (????)
*{{#expr: {{formatnum:6,0}}/{{formatnum:2,5}}}} → 2.4 (ok)

After calculation we must transform the calculated number back into decimal comma system:
*formatnum:{{#expr: {{formatnum:6,0}}/{{formatnum:2,5}}}} result: 2,4
*formatnum:{{#expr: {{formatnum:5}}/{{formatnum:2}}}} result: 2,5
*formatnum:{{#expr: {{formatnum:10000}}/{{formatnum:10}}}} result: 1 (????)

If there is any other simple solution for our calculation problems instead of FormatNum extension ..... for now I just want to calculate population density.

You are trying to indifferently use formatnum: for two different functions

If you want to convert to Slovenian notation use:
{{formatnum: <number>}}

If you want to convert from Slovenian to make operations use:
{{formatnum: <number>|R}}

{{formatnum:{{#expr: {{formatnum:6,0|}}/{{formatnum:2,5|R}} }} }} result: 2,4
{{formatnum:{{#expr: {{formatnum:5|R}}/{{formatnum:2|R}} }} }} result: 2,5
{{formatnum:{{#expr: {{formatnum:10000|R}}/{{formatnum:10|R}} }} }} result: 1.000

Use of {{formatnum: <number> }} to convert from Slovenian to English notation will apparently work (as it will just be interchanging , and .) but trying to use that for matematics will fail with numbers greater than 10³ (the thousands separator will get into the way).

v.pelhan wrote:

Well I missed this R thing. I guess that solves my problem. There is no expert on parser functions in our Wikipedia and I am trying to do my best ... so ... thank you for helping me. I will try now to update our settlement infoboxes.