Make WordPress Core

Opened 14 years ago

Closed 13 years ago

Last modified 12 years ago

#13996 closed defect (bug) (fixed)

Dysfunctional i18n function

Reported by: xibe's profile xibe Owned by: nbachiyski's profile nbachiyski
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.0
Component: I18N Keywords: needs-patch
Focuses: Cc:


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 14 years ago.

Download all attachments as: .zip

Change History (13)

#1 @ocean90
14 years ago

  • Keywords needs-patch added

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

#2 @xibe
14 years ago

  • Summary changed from Dysfunctiona i18n function to Dysfunctional i18n function

#3 @nacin
14 years ago

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

#4 @xibe
14 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.

#5 @nacin
14 years ago

  • Status changed from new to assigned

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

#6 @SergeyBiryukov
14 years ago

  • Cc… 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.

#7 @nbachiyski
14 years ago

  • 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

#8 @nbachiyski
14 years ago

  • 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.

#9 @nbachiyski
14 years ago

  • Milestone changed from Awaiting Triage to 3.1

#10 @jane
13 years ago

  • 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?

#11 @nbachiyski
13 years ago

  • 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

#12 @scribu
12 years ago

Follow-up: #20188

Note: See TracTickets for help on using tickets.