Last modified: 2011-09-18 19:46:15 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 T32318, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 30318 - #expr: doesn't recognize localized numbers (aka what {{formatnum:...}} makes )
#expr: doesn't recognize localized numbers (aka what {{formatnum:...}} makes )
Status: RESOLVED WONTFIX
Product: MediaWiki extensions
Classification: Unclassified
ParserFunctions (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: i18n
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-11 05:25 UTC by reza1615
Modified: 2011-09-18 19:46 UTC (History)
4 users (show)

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


Attachments

Description reza1615 2011-08-11 05:25:21 UTC
Hi all,
mediaWiki's #expr command in other  projects such as fa.wiki doesn't support formatnum. for example {{#expr:{{formatnum:2}}*1}} has error in fa.wiki.
in fa.wiki formatnum converts 0=>۰ 1=>۱ 2=>۲ 3=>۳ 4=>۴ 5=>۵ 6=>۶ 7=>۷ 8=>۸ 9=>۹
Comment 1 db [inactive,noenotif] 2011-08-15 19:25:38 UTC
You can only do #expr on [[Arabic numerals]] and formatnum the result, not the intermediate result.

{{formatnum:{{#expr:2*1}}}}
Comment 2 reza1615 2011-08-15 19:38:31 UTC
now we are using like {{formatnum:{{#expr:2*1}}}} but when we want import complex templates like template:convert from en.wiki it has many bugs because in fa.wiki input numbers are in persian numbers so we must user {{formatnum: |R}} for all of variation but it is not so easy
Comment 3 Bawolff (Brian Wolff) 2011-08-15 19:48:26 UTC
Changing component to the extension. I'm also lowering priority (I don't feel "high" is appropriate for this bug ). And tagging i18n as its sort of an i18n issue.

formatnum: also adds comma's/period's. For example in tr language {{formatnum:1000}} becomes 1.000 (periods are the thousands separator in tr). Thus 1.000 would have very different meanings depending on if you assumed it was a formatted number or a "raw" number. (I suppose we could just transform digits and not separators, but that feels really ugly, and it'd still have to be done carefully). 

I don't feel this is a large issue because #expr is mostly used in templates, and not encountered as much by the "average" user (although I could be wrong on that), and thus am leaning towards thinking this should be a WONTFIX. Keep in mind you can also do {{#expr:{{formatnum:{{{1}}}|R}}*1}} in templates, which will de-format the number so your users can use fa numerals properly

reza1615: Could you give examples of times when this makes life difficult on fa (or other languages for that matter) projects in order to better judge if {{#formatnum:۲|R}} is sufficient (making this a wontfix) or if this should be a higher priority issue?
Comment 4 reza1615 2011-08-30 13:59:04 UTC
for example last time that i am came across with http://en.wikipedia.org/wiki/List_of_countries_by_population
it has many {{#exp:}} that they must have {{formatnum:|R}}. because we have JS tool in fa.wiki that replace Latin numbers with Farsi numbers.
so if we use it in this article it will have many bugs. also for using new templates that is made in en.wiki or other wikis we must use {{formatnum: {{{1}}}|R}} for all of input variants! in my opinion if it is solved many wikis such as Italian and Turkish that their comma's/period's is different from English also can use this possibility!
I changed it's priority to normal.
Comment 5 Niklas Laxström 2011-08-30 14:01:52 UTC
I don't like guessing whether the number is formatted or not. It has high chance of messing up decimal separators.
Comment 6 reza1615 2011-08-31 09:26:40 UTC
we can define exception for wikis.for example {{#exp:{{formatnum:}}+1}} works for fa, it , tr,... wikis.
Comment 7 Niklas Laxström 2011-08-31 10:12:40 UTC
I still think it is poor design. The templates should be made so that they parse the user input for calculations, do the math and then format it again. It keeps things separated. If it so happens that for English they can skip some steps, we just need to educate them like we educate programmers to write code that can be localised.
Comment 8 Huji 2011-09-18 17:37:00 UTC
I agree with Niklas here. It is the templates that are responsible for converting their input and output correctly.

This problem mostly occurs when you copy-paste templates from other wikis (in particular, from wikis using Latin-based languages such as English, etc). As those conversions are not needed in the aforementioned wikis, their template codes don't contain formatnum commands. In order to make them work in non-Latin languages (and by "work", I mean to accept non-Latin digits as input), one has to modify the code of the template by adding formatnum's here and there. This is cumbersome, but it is the right way to do it.

I propose marking this as WONTFIX, because it is not a limitation on the extension's part, but rather a problem associated with copy-pasting template code from non-compliant sources.
Comment 9 Bawolff (Brian Wolff) 2011-09-18 19:46:15 UTC
Marking wontfix due to concerns over decimal separator conversions messing things up.

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


Navigation
Links