[wp-trac] [WordPress Trac] #13651: Problem with plural form in comments_number
WordPress Trac
noreply at wordpress.org
Tue Feb 10 07:11:26 UTC 2015
#13651: Problem with plural form in comments_number
--------------------------+-------------------------
Reporter: pavelevap | Owner: nbachiyski
Type: defect (bug) | Status: new
Priority: high | Milestone: 4.2
Component: I18N | Version: 3.0
Severity: major | Resolution:
Keywords: has-patch | Focuses:
--------------------------+-------------------------
Changes (by SergeyBiryukov):
* milestone: Future Release => 4.2
Comment:
Since this only affects a limited number of locales, I'd like to suggest
what seems to be the least obtrusive fix there.
`comments_popup_link()` is used in each and every theme, so deprecating it
is probably not an option. Instead, we could introduce a switch similar to
the one we have [source:tags/4.1/src/wp-includes/script-loader.php#L587
for Open Sans font].
When enabled, the switch would override the theme's pseudo-plural `'%
Comments'` string with a correct form of `_n( '%s Comment', '%s Comments',
$number )`.
Only the actual word would be replaced, leaving surrounding tags and
numbers as is. This works correctly with the standard `'% Comments'`
string, as well as `'%'` or `'<b>%</b> Replies'` strings in Twenty Eleven.
If the string does not contain a `%` placeholder, it would be left as is.
If the theme wants to use an i18n-ready string for comment number, it
should either rely on core strings (for Twenty Fourteen and Twenty
Fifteen, simply removing the [source:tags/4.1/src/wp-
content/themes/twentyfifteen/inc/template-tags.php#L120 last two
parameters] would be enough), or use `_n()` for the `$more` parameter,
like we do in `comments_popup_link()` now (see [31401] and [31402]).
[attachment:13651.3.diff] includes the proposed fix and unit tests with
different strings from bundled themes.
This should eliminate the need for plugins like
[http://wordpress.org/plugins/multilingual-comments-number/ Multilingual
Comments Number] or [http://ulizko.com/russify_comments_number.html
Russify Comments Number], which were created solely to fix this issue.
WordPress should not require a plugin just to display the number of
comments correctly.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/13651#comment:51>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list