Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Format of numbers in file_download_count
Hi, developers.
I find that the default format of numbers in large counts (as in file_download_count, i.e. “Downloads: 23863”) is not very accurate. I think that it would be better to render big numbers with a dot or a space as in “Downloads: 23.863” or “Downloads: 23 863”. This issue was incorporated to the plugin fox_file_stats simply changing the last line return $stats;
and using instead return number_format($stats, 0, ',', '.');
.
Thank you anyway.
Last edited by pompilos (2013-12-13 15:10:23)
Offline
Re: Format of numbers in file_download_count
It’s accurate. The problem with using a dot or space is that it’s not a universally recognised format. For example in uk we use a comma. I guess it could be incorporated into the preferences somehow though.
Offline
Re: Format of numbers in file_download_count
philwareham wrote:
I guess it could be incorporated into the preferences somehow though.
Preferences? No. Locale and language? Potentially. Operating system’s locales, that we too use, contain both number and currency format information.
The change itself wouldn’t be more than wrapping the returned value to PHP’s number_format function and pass it formatting options from localeconv()
.
E.g.
Txp::get('L10nLocale')->setLocale(LC_ALL, 'en-gb');
print_r(localeconv());
Returns:
Array
(
[decimal_point] => .
[thousands_sep] => ,
[int_curr_symbol] => GBP
[currency_symbol] => £
[mon_decimal_point] => .
[mon_thousands_sep] => ,
[positive_sign] =>
[negative_sign] => -
[int_frac_digits] => 2
[frac_digits] => 2
[p_cs_precedes] => 1
[p_sep_by_space] => 0
[n_cs_precedes] => 1
[n_sep_by_space] => 0
[p_sign_posn] => 1
[n_sign_posn] => 1
[grouping] => Array
(
[0] => 3
[1] => 3
)
[mon_grouping] => Array
(
[0] => 3
[1] => 3
)
)
Last edited by Gocom (2013-12-13 19:18:42)
Offline