#1322 closed defect (bug) (fixed)
Missing plural forms for '%d people say it works.'
Reported by: | SergeyBiryukov | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | Plugin Directory | Keywords: | |
Cc: |
Description
There are two similar strings in plugin directory:
'%d people say it works.'
(without plural forms)._n( '1 person says it works.', '%s people say it works.', ... )
(plural)
Not sure where the latter is used, but I see the former (without plural forms support) in the Compatibility block on Jetpack page.
The former string should be removed, and the latter should be used instead.
Attachments (2)
Change History (14)
#2
in reply to:
↑ 1
;
follow-up:
↓ 3
@
9 years ago
- Resolution invalid deleted
- Status changed from closed to reopened
Replying to coffee2code:
You can load an individual plugin's page and see the output. The JS has to decide which plural form to use, so it needs both strings of each type.
I see the correct form in the page source, but then it gets replaced with an incorrect form from JS.
So essentially there's no plural forms support at all, and the correct string for initial output is misleading. Not all languages have only two plural forms :)
The JS also has another bug: if there's exactly 1 vote, it prints %s
instead of the number (see the screenshot), that's because it replaces %d
, but the singular string has %s
.
- Could we use something like Jed for proper plural forms support?
- If not, could we at least make it so that the correct initial output doesn't get replaced with an incorrect one right away, but only after some other version is selected from the dropdown?
#3
in reply to:
↑ 2
;
follow-up:
↓ 8
@
9 years ago
Replying to SergeyBiryukov:
The JS also has another bug: if there's exactly 1 vote, it prints %s instead of the number (see the screenshot), that's because it replaces %d, but the singular string has %s.
This is a result of the translation. From the code snippet I provided above, the original text for a single vote for "works" is: 1 person says it works
The translation (as can be seen for https://ru.wordpress.org/plugins/jetpack/) is
%s сообщение, что работает
(ref).
Had the translation used %d
instead of %s
, the number 1
would have been substituted in. That doesn't solve the plural support issue, but it explains the "bug" of seeing %s
.
Could we use something like Jed for proper plural forms support?
Jed would have to be part of a broader discussion for w.org, and possibly more when everything moves to WP. Short of using Jed, are there any suggestions you have for supporting more than 2 plural forms in JS?
This ticket was mentioned in Slack in #meta-i18n by ocean90. View the logs.
9 years ago
#5
@
9 years ago
This problem is also reported in Japanese forum.
https://ja.forums.wordpress.org/topic/156963
This ticket was mentioned in Slack in #meta by sam. View the logs.
9 years ago
#7
@
8 years ago
- Resolution set to wontfix
- Status changed from reopened to closed
I'm wontfixing this ticket because the new directory doesn't / won't have this issue.
#8
in reply to:
↑ 3
@
8 years ago
Replying to coffee2code:
The translation (as can be seen for https://ru.wordpress.org/plugins/jetpack/) is
%s сообщение, что работает
(ref).
Had the translation used
%d
instead of%s
, the number1
would have been substituted in. That doesn't solve the plural support issue, but it explains the "bug" of seeing%s
.
Thanks, but why should the translation use %d
if the original string uses %s
(meta-1322.2.png)? It's an issue with the original string then, not with the translation.
#9
follow-up:
↓ 10
@
8 years ago
- Resolution changed from wontfix to fixed
Fixed in [12229-dotorg].
Turns out the issue is the same string appears in two contexts, one as a standalone, non-pluralized string:
__( '1 person says it works.', 'wporg' )
Then again as part of a string pluralization:
_n( '1 person says it works.', '%s people say it works.', $works_num, 'wporg' )
They are actually different strings used in different contexts, but since they aren't otherwise differentiated, only the latter is presented to translators.
The former is used in the JS to set up the singularized string for it to use, and that's what most people will see when then count is 1 (when JS is active, obviously). And the JS only replaces %d
with the count, not %s
, thus the %s
was shown on the front-end. The pluralized version uses %s
because in that context the count is passed through bb_number_format_i18n()
.
I changed the translation of the first instance of the string (as cited above) to be:
_x( '1 person says it works.', 'non-pluralized singular', 'wporg' ) _x( "1 person says it's broken.", 'non-pluralized singular', 'wporg' )
This should cause them to appear as separately translatable strings. In the translation, %d
can be used in place of 1
.
#10
in reply to:
↑ 9
;
follow-up:
↓ 11
@
8 years ago
Replying to coffee2code:
I changed the translation of the first instance of the string (as cited above) to be:
_x( '1 person says it works.', 'non-pluralized singular', 'wporg' ) _x( "1 person says it's broken.", 'non-pluralized singular', 'wporg' )This should cause them to appear as separately translatable strings. In the translation,
%d
can be used in place of1
.
Cheers, thank you for the fix!
It seems like the new strings are not yet available for translation though, any idea why?
https://translate.wordpress.org/projects/meta/plugins/ru/default
#11
in reply to:
↑ 10
;
follow-up:
↓ 12
@
8 years ago
Replying to SergeyBiryukov:
It seems like the new strings are not yet available for translation though, any idea why?
https://translate.wordpress.org/projects/meta/plugins/ru/default
The POT generation and import is already disabled for the old directory…
The former is part of the JS related to the compatibility feature. The JS allows the "it works" and "it's broken" text under the 'Compatibility' dropdowns on individual plugin pages to update dynamically as the dropdown values are changed. It is passed translated strings for singular and plural forms for 'works' and 'broken'.
Here's the actual code defining those strings (ignore the deprecated function use...):
You can load an individual plugin's page and see the output. The JS has to decide which plural form to use, so it needs both strings of each type.
The latter string translation you noted is the text used for the initial output of the 'Compatibility' section.
Seems like the current approach is a legitimate use for non-plural forms support.
Feel free to reopen with recommendations for changing the JS or for passing context to translators if it's beneficial to do so.