? Failure

User tests: Successful: Unsuccessful:

avatar demis-palma
demis-palma
27 Feb 2014

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.

avatar demis-palma demis-palma - open - 27 Feb 2014
avatar infograf768
infograf768 - comment - 27 Feb 2014

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.

avatar mbabker
mbabker - comment - 27 Feb 2014

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'
avatar demis-palma
demis-palma - comment - 27 Feb 2014

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.

avatar demis-palma demis-palma - close - 27 Feb 2014
avatar demis-palma demis-palma - change - 27 Feb 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-02-27 18:25:51
avatar demis-palma demis-palma - close - 27 Feb 2014
avatar demis-palma
demis-palma - comment - 27 Feb 2014

Opened the new pull #3198
Postponed modification on JHtmlNumber::bytes() because it implies to take a look to the tests.

Add a Comment

Login with GitHub to post a comment