Ticket #4865 (closed enhancement: fixed)

Opened 1 year ago

Last modified 8 months ago

Change plurals in text to allow for translations

Reported by: nbachiyski Assigned to: westi
Priority: lowest Milestone: 2.5
Component: i18n Version: 2.3
Severity: trivial Keywords: plurals has-patch needs-testing dev-feedback
Cc:

Description

There are many places in the source, where counts were used, but the plural form is mentioned only. It isn't related to i18n only, the messages in English will benefit from it also.

Attachments

wp_counted_string.diff (1.5 kB) - added by darkdragon on 12/20/07 02:50:01.
Helper function for providing translatable plurals
i18n.#4865.patch (2.1 kB) - added by darkdragon on 12/20/07 02:53:59.
Fixes two functions to use new wp_counted_string function
i18n.greymatter.#4865.patch (1.0 kB) - added by darkdragon on 12/20/07 02:59:42.
Converted Greymatter importer to use wp_counted_string function
i18n.blogware.#4865.2.patch (405 bytes) - added by darkdragon on 12/20/07 04:28:21.
Uses ngettext function instead of wp_counted_string function
i18n.blogware.#4865.patch (397 bytes) - added by darkdragon on 12/20/07 04:30:45.
Uses __ngettext function instead of wp_counted_string function
i18n.pluggable.#4865.patch (1.2 kB) - added by darkdragon on 12/20/07 04:35:15.
Removes wp_counted_string function and uses __ngettext() instead for pluggables file.
i18n.complete.#4865.patch (10.9 kB) - added by darkdragon on 12/20/07 05:19:43.
Covers complete translation for plurals and covers #5164 plurals
i18n.complete.#4865.2.patch (10.9 kB) - added by nbachiyski on 12/20/07 08:48:29.
Tiny fixes for darkdragon's patch

Change History

12/16/07 21:06:55 changed by darkdragon

  • keywords changed from i18n texts plurals to i18n texts plurals reporter-feedback.

Can you give instances of possible candidates that should be changed?

12/20/07 00:21:21 changed by nbachiyski

  • type changed from defect to enhancement.

12/20/07 00:30:02 changed by lloydbudd

  • status changed from new to closed.
  • resolution set to invalid.
  • milestone deleted.

Closing for until concrete examples/symptoms of the problem.

12/20/07 00:42:14 changed by nbachiyski

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

Somebody wanted examples :-)

  • wp-includes/pluggable.php:634 -- Currently %s comments are waiting for approval. Please...
  • wp-content/plugins/akismet/akismet.php:678 -- %d spam comments have been blocked by...
  • wp-admin/import/greymatter.php:275 -- imported %d comment(s)
  • wp-admin/import/greymatter.php:280 -- ignored %d pre-existing comments
  • wp-admin/import/blogware.php:144 -- (%s comments)
  • wp-admin/import/livejournal.php:122 -- (%s comments)
  • wp-admin/import/mt.php:241 -- (%s comments)
  • wp-admin/import/wordpress.php:432 -- (%s comments)
  • wp-admin/import/btt.php:71 -- Done! <strong>%s</strong> posts with tags were read.
  • wp-admin/import/jkw.php:87 -- Done! <strong>%s</strong> posts with tags were read.
  • wp-admin/import/dotclear.php:529 -- Done! <strong>%s</strong> links or link categories imported
  • wp-admin/import/jkw.php:128 -- Done! <strong>%s</strong> tags were read.
  • wp-admin/import/utw.php:87 -- Done! <strong>%s</strong> tags were read.
  • wp-admin/import/mt.php:258 -- (%s pings)
  • wp-admin/import/stp.php:76 -- Done! <strong>%s</strong> tag to post relationships were read.
  • wp-admin/import/utw.php:139 -- Done! <strong>%s</strong> tag to post relationships were read.
  • wp-admin/import/stp.php:94 -- Done! <strong>%s</strong> tags where added!
  • wp-admin/import/textpattern.php:465 -- Done! <strong>%s</strong> Links imported
  • wp-admin/import/utw.php:160 -- Done! <strong>%s</strong> tags were added!

12/20/07 01:28:22 changed by darkdragon

Okay. I'll create a patch, unless someone else is already doing so.

If you find any more, then post it, please.

12/20/07 01:44:50 changed by darkdragon

  • summary changed from gettext plurals to Change plurals in text to allow for translations.

12/20/07 02:46:38 changed by darkdragon

I can't offer a patch for the Akismet Plugin. It is not part of the WordPress Repository.

12/20/07 02:50:01 changed by darkdragon

  • attachment wp_counted_string.diff added.

Helper function for providing translatable plurals

12/20/07 02:50:46 changed by darkdragon

  • keywords changed from i18n texts plurals reporter-feedback to plurals has-patch needs-testing.
  • milestone set to 2.4.

12/20/07 02:51:55 changed by darkdragon

  • keywords changed from plurals has-patch needs-testing to i18n plurals has-patch needs-testing.

12/20/07 02:52:10 changed by darkdragon

  • component changed from General to i18n.

12/20/07 02:52:24 changed by darkdragon

  • keywords changed from i18n plurals has-patch needs-testing to plurals has-patch needs-testing.

12/20/07 02:53:59 changed by darkdragon

  • attachment i18n.#4865.patch added.

Fixes two functions to use new wp_counted_string function

12/20/07 02:59:42 changed by darkdragon

  • attachment i18n.greymatter.#4865.patch added.

Converted Greymatter importer to use wp_counted_string function

12/20/07 03:53:15 changed by darkdragon

  • keywords changed from plurals has-patch needs-testing to plurals has-patch needs-testing dev-feedback.

I need to know if the wp_counted_string() can be committed as a possible fix and usage in the core of WordPress. It appears that the function would be of use and was adapted from a comments-template.php function.

The function needs testing (unit tests), as well as the other patches. If the function works, which given its trivial code, it should then everything else should work just fine.

12/20/07 04:22:00 changed by darkdragon

__ngettext() exists for the purpose of specifying single and plurals. It probably could be used instead to limit the usage of two many functions.

12/20/07 04:28:21 changed by darkdragon

  • attachment i18n.blogware.#4865.2.patch added.

Uses ngettext function instead of wp_counted_string function

12/20/07 04:30:45 changed by darkdragon

  • attachment i18n.blogware.#4865.patch added.

Uses __ngettext function instead of wp_counted_string function

12/20/07 04:35:15 changed by darkdragon

  • attachment i18n.pluggable.#4865.patch added.

Removes wp_counted_string function and uses __ngettext() instead for pluggables file.

12/20/07 04:55:08 changed by darkdragon

Closed #5164 as duplicate of this ticket. Need to remember that part of patch came from nbachiyski's patch for credit.

12/20/07 05:19:43 changed by darkdragon

  • attachment i18n.complete.#4865.patch added.

Covers complete translation for plurals and covers #5164 plurals

12/20/07 05:23:47 changed by darkdragon

i18n.complete.#4865.patch covers all of the known cases where gettext plurals should have been used. Should not need testing, but should be tested anyway.

The wp-admin/moderation.php and wp-admin/edit-comments.php were based off of nbachiyski's patch in #5164.

12/20/07 08:46:40 changed by nbachiyski

Just put a full stop in one case for consistency and fixed a % occurrence, instead of %s.

I like throwing ideas in the evening and finding patches in the morning -- thank you, darkdragon :-)

12/20/07 08:48:29 changed by nbachiyski

  • attachment i18n.complete.#4865.2.patch added.

Tiny fixes for darkdragon's patch

12/20/07 11:13:23 changed by westi

  • owner changed from anonymous to westi.
  • status changed from reopened to new.

12/20/07 14:03:56 changed by darkdragon

Thanks, I wouldn't have been able to fix this for another 8 hours.

I think actually, I disagreed with the placement of some of your patch, "Why not a full stop when the sentence is done?" Since I'm not an English major or know exactly how the page looks, I'll say whatever gets it done.

12/20/07 17:05:06 changed by ryan

(In [6430]) Use ngettext() for plurals. Props darkdragon. see #4865

(follow-up: ↓ 21 ) 12/30/07 05:42:06 changed by darkdragon

  • milestone changed from 2.4 to 2.5.

Sending to the next release to keep open for more considerations of strings that should use __ngettext() to allow for translatable plurals.

(in reply to: ↑ 20 ) 01/02/08 21:11:23 changed by lloydbudd

  • status changed from new to closed.
  • resolution set to fixed.
  • milestone changed from 2.5 to 2.4.

Replying to darkdragon:

Sending to the next release to keep open for more considerations of strings that should use __ngettext() to allow for translatable plurals.

Better to just open new ticket(s) for any additional phrases I think.