WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#27581 closed defect (bug) (fixed)

Plural form instead of singular for 'Based on %s ratings' in theme-install.php

Reported by: kenan3008 Owned by: johnbillion
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.9
Component: I18N Keywords: has-patch
Focuses: administration Cc:

Description

String from the theme installer (wp-admin/theme-install.php) needs to be changed from the current singular form to plural.

/wp-admin/theme-install.php (line 208)

Attachments (1)

27581.patch (5.2 KB) - added by johnbillion 5 years ago.

Download all attachments as: .zip

Change History (10)

#1 @nacin
5 years ago

  • Milestone changed from Awaiting Review to 3.9

This is going to be complicated as we don't have JS plurals. We might need to think outside the box.

#2 @johnbillion
5 years ago

  • Owner set to johnbillion
  • Status changed from new to assigned

The problem here is that the theme install screen is doing a direct AJAX call to api.wordpress.org. If we changed this to a local AJAX call which done a server-side request to api.wordpress.org we could post-process the data and use _n() to populate a string with the complete correctly pluralised phrase.

I'll knock up a patch.

@johnbillion
5 years ago

#3 @johnbillion
5 years ago

  • Keywords has-patch added

27581.patch switches the theme install screen over to using a local AJAX call instead of calling api.wordpress.org directly. The results of the call are processed and a correctly localised num_ratings_text item is added to each item in the themes array which is then used in the template.

#4 @nacin
5 years ago

The localized issue is pointed out in #27581 as well. Definitely something to consider...

The issue with going through WordPress always is that it's slower. The direct api.wordpress.org hit was something I did deliberately for speed reasons. On the other hand, we could then use themes_api() again, which would solve some mostly academic back compat concerns.

Another option is to ditch POST, XHR, CORS: The 1.1 endpoint (as of 3 minutes ago) now supports GET and JSONP via a 'callback' parameter. Additionally, to save query string length, queried tags can now be passed as comma-separated, instead of an array.

#5 @johnbillion
5 years ago

The phrase containing num_ratings needs to pass through _n() in order to correctly pluralise it, which means the result of the call to api.wordpress.org needs to go through WordPress one way or another.

Another option would be to add a language parameter to the API call and get the API to return our localised string for us, but that doesn't sound like a good idea.

#6 @nacin
5 years ago

I was thinking we'd change up the string like just do a faint (28) after the five stars.

#7 @nacin
5 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 27940:

Theme Installer: Center spinner, remove plural string.

fixes #27581. see #27055.

This ticket was mentioned in IRC in #wordpress-dev by ocean90. View the logs.


5 years ago

#9 @nacin
5 years ago

In 28126:

Theme Installer: Revert to proxying through PHP for WordPress.org API requests.

This is to ensure we have valid installation nonces, though we've run into this as a problem previously (see #27639, #27581, #27055).

A tad slower, but we gained speed in 3.9 by simplifying the request made to the API.

props ocean90.
fixes #27798.

Note: See TracTickets for help on using tickets.