Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Format numbers displayed in Piwik reports (eg. 1,000,000 instead of 1000000) #1254
Piwik displays a lot of numbers, in graphs, tables, overview reports, etc.
Depending on your country, a number is displayed differently.
The translation file could contain a NumberFormat entry that would define:
See function http://php.net/number_format
The current behavior is a mix: the graphs show US formats, while the tables and overviews don't have any specific style applied.
Every number output in Piwik would have to go through the same helper function, that would apply the translation formatting preference.
Maybe we could use some sort of Smarty magic helper functions to automatically apply the styles to numbers, the same way it currently does add the
Setting milestone as 1.0, but this might not make it if we need to update all templates to add the smarty modifier call to each number printed.
Piwik::getPrettyNumber, which turns 1000000 into 1,000,000 or 1.000.000 should be used on every numeric value in Piwik to make report data more readable. I think this can be done by:
Should probably be done after widget integration testing is up and running.
This was referenced
Dec 14, 2012
Importing the number formats to the Intl plugin should be easily doable. But I would target that for 3.0 as the changes to the timeformats are already included in 3.0 branch. What I'm not able to estimate is the time that would needed to use those number formats everywhere in Piwik
@zawadzinski Good point - this feature is a must-have! adding to 3.0.0 at least, but let's also consider whether this could be done earlier in our LTS 2.X version.
Where should number formatting be applied at minimum (MVP)?
if it could be done "relatively quickly" this would be very worth doing! @sgiehl maybe you have some time to investigate this in coming few weeks, if not let me know, thanks
I'm currently having a look at that.
I'm almost finished with importing the required data from CLDR, but using those within Piwik might be a bit more challenging...