[wp-trac] [WordPress Trac] #37789: Strange results in comment number declension
WordPress Trac
noreply at wordpress.org
Thu Sep 1 15:28:19 UTC 2016
#37789: Strange results in comment number declension
-------------------------------+------------------------------
Reporter: pavelevap | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: I18N | Version:
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Comment (by SergeyBiryukov):
Replying to [comment:2 pavelevap]:
> I can suggest our users for example `gettext` filter to change `on` to
`off`, but maybe this could be fixed somehow directly (when original
string in `comments_popup_link()` is not in English or without
localization)?
Thanks for the clarification!
The problem is that `get_comments_number_text()` doesn't know if the
string is in English or not, it just takes any text or markup passed as
the `$more` argument and looks for the `%` character followed (or
preceded) by a word.
So if declension is not needed in certain cases, `gettext` filter seems to
be the appropriate way to disable it.
You could also use `sprintf()` to insert the number yourself, that way
string would not contain the `%` character, and the supplied text will be
used as is:
{{{
comments_popup_link(
'Komentáře (0)',
'Komentáře (1)',
sprintf( 'Komentáře (%s)', number_format_i18n(
get_comments_number() ) )
);
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37789#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list