Opened 3 years ago

Closed 3 years ago

Last modified 15 months ago

#13996 closed defect (bug) (fixed)

Dysfunctional i18n function

Reported by: xibe Owned by: nbachiyski
Priority: normal Milestone: 3.1
Component: I18N Version: 3.0
Severity: normal Keywords: needs-patch
Cc: momo360modena, sergeybiryukov.ru@…

Description

With at least the fr_FR and ru_RU translation, the "All" link at the top of the /wp-admin/edit-comments.php page is still in English.

The code used in WP is:

'all' => _nx_noop('All', 'All', 'comments'), // singular not used

Could there be an issue with _nx_noop()?

Attachments (1)

add_context_to_comment_status_labels.patch (802 bytes) - added by SergeyBiryukov 3 years ago.

Download all attachments as: .zip

Change History (13)

  • Keywords needs-patch added

I can confirm it, with German lanugage it's the same.

comment:2   xibe3 years ago

  • Summary changed from Dysfunctiona i18n function to Dysfunctional i18n function

Is the string not showing up in the pot file? I imagine makepot.php might need updating...

comment:4   xibe3 years ago

It is:

#: wp-admin/edit-comments.php:215
msgctxt "comments"
msgid "All"
msgid_plural "All"
msgstr[0] ""
msgstr[1] ""

As Sergey noted on wp-polyglots, it is the only place where _nx_noop() is used.

  • Status changed from new to assigned

In that case, nx() doesn't work right.

  • Cc sergeybiryukov.ru@… added
  • Keywords has-patch added; needs-patch removed

_nx_noop() is fine; it just returns an array. I dug deeper and found the problem in edit-comments.php: this string requires translating with context using _nx(), however _n() is used, which doesn't support context.

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

(In [15295]) Check for context item, when using noop-ed plural translations. Props SergeyBiryukov, fixes #13996 for 3.0 branch

  • Keywords has-patch removed
  • Milestone changed from 3.0.1 to 3.1
  • Resolution fixed deleted
  • Status changed from closed to reopened

Sergey is right and his patch is in for 3.0.1.

For 3.1, I would like to make the *_noop() functions return an associative array, because using these indices is totally incomprehensible.

Along that, we should introduce a translate_nooped_plural() function to:

  1. Hide the complexity of the conditional use of _n() or _nx(), depending on the presence of context.
  2. Make localization of the places, where we lazy-translating noop-ed strings.
  • Milestone changed from Awaiting Triage to 3.1
  • Keywords needs-patch added

@nbachiyski: Freeze for 3.1 is a few days away. Did you still want to put in an update in this release?

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

(In [16073]) Introduce and use translate_nooped_plural(). Fixes #13996

  • _n_noop() and _nx_noop() now return associative arrays for greater clarity
  • translate_nooped_plural() takes one such associative array and translates it
  • it works on both the result from _n_noop() and from _nx_noop()
  • this breaks backwards compatibility, but I doubt any plugin uses it (I will do a global grep to confirm)
  • translate_nooped_plural() is applied where applicable

Follow-up: #20188

Note: See TracTickets for help on using tickets.