Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Number.php |
— | — | @@ -43,7 +43,7 @@ |
44 | 44 | |
45 | 45 | $parts = preg_split('/([-+]?\s*\d+(?:\\' . $kiloseparator . '\d\d\d)*' . |
46 | 46 | '(?:\\' . $decseparator . '\d+)?\s*(?:[eE][-+]?\d+)?)/u', |
47 | | - trim(str_replace(array(' ',' '), '', $value)), |
| 47 | + trim(str_replace(array(' ',' ', ' '), '', $value)), |
48 | 48 | 2, PREG_SPLIT_DELIM_CAPTURE); |
49 | 49 | |
50 | 50 | if (count($parts) >= 2) { |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php |
— | — | @@ -633,7 +633,6 @@ |
634 | 634 | */ |
635 | 635 | function smwfNumberFormat($value, $decplaces=3) { |
636 | 636 | $decseparator = wfMsgForContent('smw_decseparator'); |
637 | | - $kiloseparator = wfMsgForContent('smw_kiloseparator'); |
638 | 637 | |
639 | 638 | // If number is a trillion or more, then switch to scientific |
640 | 639 | // notation. If number is less than 0.0000001 (i.e. twice decplaces), |
— | — | @@ -672,10 +671,11 @@ |
673 | 672 | $value = str_replace('.', $decseparator, $value); |
674 | 673 | } |
675 | 674 | } else { |
676 | | - // Format to some level of precision; |
677 | | - // this does rounding and locale formatting. |
678 | | - $value = number_format($value, $decplaces, $decseparator, wfMsgForContent('smw_kiloseparator')); |
679 | | - |
| 675 | + // Format to some level of precision; number_format does rounding and locale formatting, |
| 676 | + // x and y are used temporarily since number_format supports only single characters for either |
| 677 | + $value = number_format($value, $decplaces, 'x', 'y'); |
| 678 | + $value = str_replace(array('x','y'),array($decseparator, wfMsgForContent('smw_kiloseparator')),$value); |
| 679 | + |
680 | 680 | // Make it more readable by removing ending .000 from nnn.000 |
681 | 681 | // Assumes substr is faster than a regular expression replacement. |
682 | 682 | $end = $decseparator . str_repeat('0', $decplaces); |