Ticket #5131 (closed enhancement: fixed)

Opened 1 year ago

Last modified 1 year ago

wp_tag_cloud(): title='1 topics', should be 1 topic

Reported by: atppp Assigned to: westi
Priority: normal Milestone: 2.5
Component: General Version: 2.3
Severity: normal Keywords: has-patch
Cc:

Description

I am picky...

Attachments

category-template.php.diff (0.8 kB) - added by webrocker on 10/02/07 14:57:44.
category-template.php.diff.txt (0.8 kB) - added by webrocker on 10/02/07 23:53:25.

Change History

10/02/07 14:57:44 changed by webrocker

  • attachment category-template.php.diff added.

10/02/07 14:59:58 changed by webrocker

  • keywords set to has patch.
  • version set to 2.3.
  • type changed from defect to enhancement.
  • milestone changed from 2.5 to 2.3.1.

10/02/07 15:02:39 changed by webrocker

been there done that :)

(follow-up: ↓ 6 ) 10/02/07 16:11:21 changed by Nazgul

  • keywords deleted.

This patch kills right-to-left language support.

10/02/07 16:18:08 changed by foolswisdom

  • milestone changed from 2.3.1 to 2.5.

Please don't set the milestone, leave that for a core contributor.

(follow-up: ↓ 7 ) 10/02/07 16:19:33 changed by westi

Replying to Nazgul:

This patch kills right-to-left language support.

Indeed, patch should be reworked to use __ngettext rather than __

(in reply to: ↑ 3 ; follow-up: ↓ 8 ) 10/02/07 17:28:04 changed by webrocker

Replying to Nazgul:

This patch kills right-to-left language support.

Ooops. Is this because of the way how the digit is 'handwired' in front of the 'topics' label (like '1 topic'), whereas a right-to-left needs something like 'topic 1'? In the original it is sprintf( __('%d topics'), $count ), so the digit is in front of the label anyway? Sorry, I don't get the difference between a hardcoded 'topics' after the %d and the variable used in my patch sprintf( __('%d '.$topictxt), $count ).

Replying to foolswisdom:

Please don't set the milestone, leave that for a core contributor.

Ok, sorry for that.

Replying to westi:

Indeed, patch should be reworked to use __ngettext rather than __

well the original used __ , so I didn't messed with that.

(in reply to: ↑ 5 ; follow-up: ↓ 9 ) 10/02/07 17:43:02 changed by webrocker

Replying to westi:

Indeed, patch should be reworked to use __ngettext rather than __

I see... would this work
original:
attribute_escape( sprintf( __('%d topics'), $count ) )
patch:
attribute_escape( __ngettext( 'topic', 'topics', $count )
?

(in reply to: ↑ 6 ) 10/02/07 18:03:02 changed by foolswisdom

Replying to webrocker:

Replying to foolswisdom:

Please don't set the milestone, leave that for a core contributor.

Ok, sorry for that.

No serious problem of course! ;-) Keep up the great work!

(in reply to: ↑ 7 ; follow-up: ↓ 11 ) 10/02/07 20:27:32 changed by westi

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

Replying to webrocker:

Replying to westi:

Indeed, patch should be reworked to use __ngettext rather than __

I see... would this work
original:
attribute_escape( sprintf( __('%d topics'), $count ) )
patch:
attribute_escape( __ngettext( 'topic', 'topics', $count )
?

Nearly __ngettext allows you to use plural forms in your translations e.g.:

__ngettext( '%d topic', '%d topics', $count)

This will output '1 topic' or '3 topics' giving you the correct plural form while still allowing translators to handle the "right to left" issues by translating the '%d topic' as something like 'topic %d'.

10/02/07 23:40:57 changed by JeremyVisser

Not a good idea to go in 2.3.1 – string changes are bad for translators.

(in reply to: ↑ 9 ) 10/02/07 23:48:59 changed by webrocker

Replying to westi:

__ngettext( '%d topic', '%d topics', $count) This will output '1 topic' or '3 topics' giving you the correct plural form while still allowing translators to handle the "right to left" issues by translating the '%d topic' as something like 'topic %d'.

Ok, I think I'm getting it... so it still needs to be used inside the sprintf() function, so that the %d thingie gets replaced with $count, while the __ngettext() needs another instance of $count to determine if $single or $plural is to be used? So this should work:
attribute_escape( sprintf( __ngettext( '%d topic', '%d topics', $count ), $count ) )

10/02/07 23:53:25 changed by webrocker

  • attachment category-template.php.diff.txt added.

10/02/07 23:58:59 changed by webrocker

  • keywords set to has-patch.

I have tested the above in my 2.3 install, and it works, so I attached another patch-file.

10/03/07 16:42:30 changed by foolswisdom

  • milestone changed from 2.5 to 2.4.

10/09/07 18:53:48 changed by westi

Relates to #5172 and #5171 all tag cloud changes.

I will get these all in soon.

10/12/07 19:49:26 changed by westi

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

(In [6227]) Translation fix for wp_tag_cloud(). Fixes #5131 props webrocker