Skip to content

[JHtmlNumber::bytes] Format number according to language#12929

Merged
wilsonge merged 6 commits intojoomla:stagingfrom
andrepereiradasilva:patch-25
Nov 18, 2016
Merged

[JHtmlNumber::bytes] Format number according to language#12929
wilsonge merged 6 commits intojoomla:stagingfrom
andrepereiradasilva:patch-25

Conversation

@andrepereiradasilva
Copy link
Copy Markdown
Contributor

@andrepereiradasilva andrepereiradasilva commented Nov 17, 2016

Pull Request for New Issue.

Summary of Changes

As discussed in joomla/joomla-websites#765 JHtmlNumber::bytes() is returning the number format always in english format.

This PR makes it return the format in the current language, using the languages packs DECIMALS_SEPARATOR and THOUSANDS_SEPARATOR variables for formatting the number.

Testing Instructions

  • Use a multilingual site with some languages (example: pt-PT) and apply patch
  • Add to protostar index.php the following code
echo JHtmlNumber::bytes(1).'<br/>';
echo JHtmlNumber::bytes(1024).'<br/>';
echo JHtmlNumber::bytes(1024*1024).'<br/>';
echo JHtmlNumber::bytes(1024*1024*1024).'<br/>';
echo JHtmlNumber::bytes(1024*1024*1024*1024).'<br/>';
  • Go to site and check if the number format is correct in all the languages you installed (you can check if respect the language variables in /language/xx-XX/xx-XX.ini file).

Documentation Changes Required

None.

@infograf768
Copy link
Copy Markdown
Member

In English I get:
1.00 b
1.00 kB
1.00 MB
1.00 GB
1.00 TB

and in French
1,00 b
1,00 kB
1,00 MB
1,00 GB
1,00 TB

When I changed the echo to
echo JHtmlNumber::bytes(1000*1024*1024*1024*1024).'<br/>';
I got
1 000,00 TB

Which is indeed correct in French.

@infograf768
Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on 78256e2


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12929.

@zero-24 zero-24 added this to the Joomla 3.7.0 milestone Nov 18, 2016
@zero-24
Copy link
Copy Markdown
Contributor

zero-24 commented Nov 18, 2016

I have tested this item ✅ successfully on 78256e2

👍


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12929.

@zero-24 zero-24 added the RTC This Pull Request is Ready To Commit label Nov 18, 2016
@zero-24
Copy link
Copy Markdown
Contributor

zero-24 commented Nov 18, 2016

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12929.

@wilsonge wilsonge merged commit 923c361 into joomla:staging Nov 18, 2016
@joomla-cms-bot joomla-cms-bot removed Unit/System Tests RTC This Pull Request is Ready To Commit labels Nov 18, 2016
@wilsonge
Copy link
Copy Markdown
Contributor

Thanks :)

@andrepereiradasilva andrepereiradasilva deleted the patch-25 branch November 18, 2016 17:53
roland-d added a commit to roland-d/joomla-cms that referenced this pull request Nov 25, 2016
* staging: (98 commits)
  Coding style. PHP constants true, false, and null MUST be in lower case. (joomla#13010)
  Removing duplicated AS in sql query (joomla#13006)
  Fixed typo in comment (joomla#12992)
  Correcting strings in TFA Google plugin (joomla#12980)
  code style changes (joomla#12986)
  Error in sr-YU installation ini file (joomla#12984)
  New DateTime picker (replaces calendar) (joomla#11138)
  Export of Banners Tracks Does Not Export the Banner Name
  fix rues get data (joomla#12763)
  Added Feature items filter to mod_articles_news (joomla#12547)
  fix them all (joomla#12943)
  a11y regression fix (joomla#12935)
  Set correct component id for system links (joomla#12938)
  Fix for Undefined offset in Content History preview popup (joomla#12791)
  remove tab on meta charset (joomla#12895)
  JSession patched to set session _state to 'inactive' when session is closed. (joomla#12928)
  [JHtmlNumber::bytes] Format number according to language (joomla#12929)
  Update edit.php (joomla#12818)
  Update default.xml (joomla#12917)
  Adding the ability to use the global value for character count in newsfeeds (joomla#12869)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants