Ticket #8128 (reopened defect (bug))

Opened 2 months ago

Last modified 1 month ago

Some plural strings need contextual disambiguation for translation purposes

Reported by: hervada Assigned to: anonymous
Priority: normal Milestone: 2.8
Component: i18n Version: 2.7
Severity: normal Keywords: i18n needs-patch
Cc: xibe

Description

As Xavier Borderie pointed out at wp-polyglots [1] there are some strings that cannot be correctly localised because their are used in different contexts (See Xavier's posting for examples.)

[1] http://comox.textdrive.com/pipermail/wp-polyglots/2008-November/002890.html

These are all the conflicting strings:

#: wp-admin/edit-pages.php:76 wp-admin/includes/post.php:730 #, php-format msgid "Published <span class=\"count\">(%s)</span>" msgid_plural "Published <span class=\"count\">(%s)</span>"

#: wp-admin/edit-pages.php:77 msgid "Scheduled pages"

#: wp-admin/edit-pages.php:77 wp-admin/includes/post.php:731 #, php-format msgid "Scheduled <span class=\"count\">(%s)</span>" msgid_plural "Scheduled <span class=\"count\">(%s)</span>"

#: wp-admin/edit-pages.php:78 msgid "Pending pages" msgstr "PĂ gines pendents"

#: wp-admin/edit-pages.php:78 wp-admin/includes/post.php:732 #, php-format msgid "Pending Review <span class=\"count\">(%s)</span>" msgid_plural "Pending Review <span class=\"count\">(%s)</span>"

#: wp-admin/edit-pages.php:79 wp-admin/includes/post.php:733 msgid "Drafts|manage posts header"

#: wp-admin/edit-pages.php:79 wp-admin/includes/post.php:733 #, php-format msgid "Draft <span class=\"count\">(%s)</span>" msgid_plural "Drafts</a> <span class=\"count\">(%s)</span>"

#: wp-admin/edit-pages.php:142 wp-admin/edit.php:129 wp-admin/upload.php:195 #: wp-admin/users.php:281 #, php-format msgid "All <span class=\"count\">(%s)</span>" msgid_plural "All <span class=\"count\">(%s)</span>"

#: wp-admin/includes/post.php:734 #, php-format msgid "Private <span class=\"count\">(%s)</span>" msgid_plural "Private <span class=\"count\">(%s)</span>"

Attachments

contextual-ngettext.diff (1.9 kB) - added by nbachiyski on 11/25/08 13:54:23.
Adds a ngettext variant, which supports contexts
plural-context-part-0.diff (2.7 kB) - added by nbachiyski on 11/25/08 14:09:14.
Plural post/page differentiation for edit-pages.php

Change History

(follow-up: ↓ 6 ) 11/09/08 19:36:10 changed by hervada

I have found 2 problems trying to solve this:

1. The ngettext() function, which is used to give the singular/plural form for most of the above strings, does not know about context pipes. I think we must create a new function e.g. _nc() which does the combination of _c() and ngettext(), that is, it gives the singular/plural form according to amount and stripes out everything from the pipe | character.

2. At edit-pages.php:76 there is no direct call to ngettext but an array such as: array(('Published'), ('Published pages'), ngettext_noop('Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>'))

11/18/08 12:08:32 changed by xibe

  • cc set to xibe.
  • keywords changed from needs-patch to i18n needs-patch.

This was already mentionned by me here in March 2007, but I didn't push it then - only wishing for it to be included in the next major version.

The discussion about it on wp-polyglots received some good tractions from the Italian, Catalan, Arabic and Hebrew members. This would most probably be helpful to all Latin languages, at least.

While Francesc (hervada) seems to have hit a wall with the solution I thought of, could this still be achieved for 2.7?

11/21/08 18:15:01 changed by westi

  • status changed from new to closed.
  • resolution set to duplicate.

I believe this is a dupe of #8154 which is getting a lot of work done on it.

Closing as such.

Please re-open if I an incorrect.

(follow-up: ↓ 5 ) 11/21/08 20:41:40 changed by hervada

  • status changed from closed to reopened.
  • resolution deleted.

No, this is not a duplicate of #8154, the problem is similar but it referes to other places and the type of solution proposed there does not fit the problem at this ticket because of the 2 Problems I mentioned above. Thus I am reopening this ticket.

(in reply to: ↑ 4 ) 11/21/08 22:08:19 changed by westi

Replying to hervada:

No, this is not a duplicate of #8154, the problem is similar but it referes to other places and the type of solution proposed there does not fit the problem at this ticket because of the 2 Problems I mentioned above. Thus I am reopening this ticket.

Cool. No Problem.

11/25/08 13:54:23 changed by nbachiyski

  • attachment contextual-ngettext.diff added.

Adds a ngettext variant, which supports contexts

11/25/08 14:09:14 changed by nbachiyski

  • attachment plural-context-part-0.diff added.

Plural post/page differentiation for edit-pages.php

(in reply to: ↑ 1 ) 11/25/08 14:13:43 changed by nbachiyski

Replying to hervada:

I have found 2 problems trying to solve this: 1. The __ngettext() function, which is used to give the singular/plural form for most of the above strings, does not know about context pipes. I think we must create a new function e.g. _nc() which does the combination of _c() and __ngettext(), that is, it gives the singular/plural form according to amount and stripes out everything from the pipe | character.

See contextual-ngettext.diff.

2. At edit-pages.php:76 there is no direct call to __ngettext but an array such as: array(__('Published'), __('Published pages'), __ngettext_noop('Published...

Later __ngettext() is called on the computed values, not the literal strings. See plural-context-part-0.diff

11/25/08 22:25:21 changed by ryan

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [9887]) Contextual ngettext from nbachiyski. fixes #8128

11/25/08 23:39:34 changed by nbachiyski

  • status changed from closed to reopened.
  • resolution deleted.

Some more patches are needed, this was just proof of concept.

12/02/08 09:03:47 changed by nbachiyski

  • milestone changed from 2.7 to 2.8.

Changing so many strings after RC1 isn't a good idea. Leaving for 2.8.