Last modified: 2008-10-28 08:17:59 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 T10063, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 8063 - JavaScript table sort does not observe local language with respect to digit groups, decimals and date formats
JavaScript table sort does not observe local language with respect to digit g...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.10.x
All All
: Normal normal with 8 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-11-28 08:53 UTC by henna
Modified: 2008-10-28 08:17 UTC (History)
2 users (show)

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


Attachments

Description henna 2006-11-28 08:53:17 UTC
sort table sorts on . for decimal sign, dutch uses . als a number grouping
symbol and , as a decimal sign:
234 567.7865 (en) = 234.567,7865 or 234 567,7865(nl)

neither does it sort correct on dates:
nl uses dd-mm-yy
Comment 1 Simon Kågedal 2007-01-30 21:34:00 UTC
This would be very much appreciated for Wikipedia in Swedish as well. 

As an example, see the article "Lista över grundämnen"
http://sv.wikipedia.org/w/index.php?title=Lista_%C3%B6ver_grund%C3%A4mnen&oldid=3480541
and try sorting by "Atommassa" (atomic weight). 
Comment 2 Simon Kågedal 2007-02-15 20:39:35 UTC
There is currently a hack in place on svwp that fixes this:

http://sv.wikipedia.org/w/index.php?title=MediaWiki:Common.js&diff=3698408&oldid=3664899
Comment 3 Raimond Spekking 2007-02-15 22:57:04 UTC
(In reply to comment #2)
> There is currently a hack in place on svwp that fixes this:
> 
>
http://sv.wikipedia.org/w/index.php?title=MediaWiki:Common.js&diff=3698408&oldid=3664899
> 

If we used this function:

function ts_parseFloat(num) {
       if (!num) return 0;
       num = num.replace(/\./g, "");
       num = num.replace(/,/g, ".");
       num = parseFloat(num);
       return (isNaN(num) ? 0 : num);
}

we need a distinction of cases based on $wgUserLanguage for a language specific
handling of . and , in numbers.
Comment 4 Simon Kågedal 2007-02-17 00:09:25 UTC
(reply to comment #3 by Raimond Spekking)

I don't think we should use $wgUserLanguage, since this needs to be a per-wiki
setting, not a per-user setting. Maybe something like this:

---------
ts_decimal_separator = ".";

function ts_parseFloat(num) {
        if (!num) return 0;
	num = num.replace(/\s/g, "");	// remove whitespaces
	num = num.replace(/'/g, "");	// remove apostrophes; used in German-speaking
Switzerland as thousands separator
	if (ts_decimal_separator == ",") {
		num = num.replace(/\./g, "");	
		num = num.replace(/,/, ".");
	} else {
		// TODO: handle the "Momayyez" character, used in Arab countries and Iran
		num = num.replace(/,/g, "");
	}
        num = parseFloat(num);
        return (isNaN(num) ? 0 : num);
}
---------

This handles most cases. Then wikis can set "ts_decimal_separator" to "," in
their [[MediaWiki/common.js]] to get comma style. Maybe there is a better way to
do this..?

"Momayyez" should maybe be handled for Arab countries, but I don't know what the
code point for that is; [[en:Momayyez]] doesn't say. 
Comment 5 Phil Boswell 2007-02-17 19:15:08 UTC
(In reply to comment #4)
> "Momayyez" should maybe be handled for Arab countries, but I don't know what thecode point for that is;
> [[en:Momayyez]] doesn't say. 

You mean "The Momayyez ("٫", Unicode U+066B) is a decimal separator used in the Arab world and Iran"? I would 
assume that "U+066B" is what you are loking for?
Comment 6 Mehdi Ghanimifard 2008-06-21 04:36:01 UTC
A major problem for Arabic and Persian language is their Unicode digits:
I tried a code in my monobook:
http://fa.wikipedia.org/w/index.php?oldid=1266410
Comment 7 Tim Starling 2008-10-28 08:17:59 UTC
The numeric part of the report is fixed in r42715. For dates please see bug 8226.

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


Navigation
Links