WordPress.org

Make WordPress Core

Opened 12 months ago

Last modified 10 months ago

#37287 new defect (bug)

wp_print_admin_notice_templates() does not use _n*() for plural forms

Reported by: ideag Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.6
Component: I18N Keywords:
Focuses: javascript, administration Cc:

Description

Function wp_print_admin_notice_templates() (https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes/update.php#L615) does not properly use _n() and related functions for plural forms of its strings. It just makes a simple if (count ===1) check and uses two different strings - one for singular, one for plural form.

This presents a problem when translating into languages that have more than one plural form, or more complicated rules for singular form usage. For example, in Lithuanian we also use singular form for 21, 1241 and any other number that ends with 1 (except for 11). And we have two plural forms - one for numbers ending with a zero, another for everything else. In current situation we can not have a proper translation here.

Change History (7)

This ticket was mentioned in Slack in #feature-shinyupdates by arunas. View the logs.


12 months ago

#2 @ideag
12 months ago

OK, as I understand, this will not get fixed until #20491 gets fixed. So not in time for 4.6 or anything like it. Just use generic strings.

#3 follow-up: @SergeyBiryukov
12 months ago

Noticed the same when translating yesterday. Yes, it depends on #20491 to be implemented properly (we can't just use _n() here, as it's a JS template).

For now, I would use some kind of a workaround in translation, e.g. "Plugins (%s) successfully updated".

#4 @ocean90
12 months ago

  • Focuses javascript added
  • Milestone changed from Awaiting Review to Future Release

#5 in reply to: ↑ 3 @ideag
12 months ago

Replying to SergeyBiryukov:

Noticed the same when translating yesterday. Yes, it depends on #20491 to be implemented properly (we can't just use _n() here, as it's a JS template).

For now, I would use some kind of a workaround in translation, e.g. "Plugins (%s) successfully updated".

Well, we could hold of on introducing faulty logic into the core and use generic strings right there.
But I guess shiny updates have to be, well, shiny. At least in English :)

I haven't looked into where data.successes comes from, but if it originates in PHP, maybe we could pass a pluralized string to it readily instead of having that logic in JavasScript at all? OK, I see we can't do that here.

Last edited 12 months ago by ideag (previous) (diff)

This ticket was mentioned in Slack in #polyglots by pokeraitis. View the logs.


11 months ago

#7 @swissspidy
10 months ago

#37811 was marked as a duplicate.

Note: See TracTickets for help on using tickets.