User tests: Successful: Unsuccessful:
Added support for localized (and parameterized) numeric format
Formatting numeric values sometimes involves decimals separator and thousands separator.
A wide variety of formats exists in the world (see http://en.wikipedia.org/wiki/Thousands_separator#Digit_grouping), but currently Joomla only uses the American format, where the decimals separator is a mark and the thousands separator is a comma (2,000.5 MB). For example, European format is the opposite (2.000,5 MB).
Even worse, this format is hardcoded into the code so that it can't be easily changed.
This contribute removes the constants "." and "," used along the Joomla code, and introduces the use of DECIMALS_SEPARATOR and THOUSANDS_SEPARATOR language strings, which will be localized by the language Teams.
Enjoy it.
The unit test failures are due to the change in output. Previously, unformatted number strings are returned, with this PR they are formatted.
8) JHtmlNumberTest::testBytes with data set #8 ('1048576 GB', 1125899906842624, 'GB')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'1048576 GB'
+'1,048,576.00 GB'
Sorry, I had problems on my Internet connection and I haven't finished the job.
I'll try again on the staging branch. Thank you.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-02-27 18:25:51 |
This PR should be versus staging and not master.
Also please create a tracker on Joomlacode and cross reference.
Looks like we would need updates to test for this.