Opened 17 months ago
Closed 13 months ago
#19593 closed defect (bug) (fixed)
Incorrect plugin ratings on decimal comma locales
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.4 |
| Component: | Administration | Version: | |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: |
Description
On some PHP locales, comma is used as a decimal separator.
This creates visual problems with plugin ratings and tag cloud on Install Plugins screen (see the screenshot).
Browser fails to handle font-size attributes with commas properly, as CSS specification only supports decimal point as a separator:
http://www.w3.org/TR/CSS21/syndata.html#length-units
To reproduce, add this to wp-config.php:
setlocale(LC_ALL, 'fr_FR');
unserialize() in plugins_api() would then return values with commas, even if WP.org API returns them with points: http://core.trac.wordpress.org/browser/tags/3.3/wp-admin/includes/plugin-install.php#L48
Related: #18460
Attachments (3)
Change History (10)
SergeyBiryukov — 17 months ago
SergeyBiryukov — 17 months ago
SergeyBiryukov — 17 months ago
comment:2
in reply to:
↑ 1
SergeyBiryukov — 17 months ago
Replying to nacin:
Perhaps the API call could return a string instead?
I guess that would fix the ratings, but not the tag cloud (see the second screenshot).
comment:4
SergeyBiryukov — 17 months ago
Right. #19624
- Keywords commit added
In the future, we should probably have a helper for this.
$theme->rating (which has moved to the customizer, so this patch no longer applies cleanly) is a number 1-100. It can be a float (the API simply takes the 1-5 rating and multiplies it by 20 to give a percentage), but the customizer intval()'s it. So we're good there.

Perhaps the API call could return a string instead?