Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 10 years ago

#7989 closed defect (bug) (fixed)

Translate "topic/topics" in the tag cloud

Reported by: msi08's profile msi08 Owned by: ryan's profile ryan
Milestone: 2.7 Priority: normal
Severity: normal Version:
Component: I18N Keywords: has-patch
Focuses: Cc:


Found a not translated text in "wp_generate_tag_cloud". This here will not work:

'single_text' => '%d topic', 'multiple_text' => '%d topics'

__ngettext( $single_text, $multiple_text, $count )

poEdit and other tools will not detect the both strings and because of that you will not have them in the language file. The translation is impossible then.

Attachments (2)

category-template.diff (453 bytes) - added by msi08 15 years ago.
tag-cloud-topics-text-i18n.diff (3.4 KB) - added by nbachiyski 15 years ago.

Download all attachments as: .zip

Change History (8)

#1 @ryan
15 years ago

ngettext() still needs to be removed.

#2 @markjaquith
15 years ago

  • Owner changed from anonymous to ryan

#3 @nbachiyski
15 years ago

  • Keywords has-patch added

In general it is ok to use __ngettext() as a function to choose the right form, based on a count, even if it is not translated. The patch above will work well in most of the cases. However, there are languages, which have different plural rules (different plural form for counts divisible by 13 and such strange stuff).

Here is a patch, which replaces the two arguments with one -- a callback, which given the count, returns the proper text. The default callback is an __ngettext() call with '%s topic' and '%s topics'.

Backward compatibility is maintained, by checking if $args['single_text'] and $args['multiple_text'] are defined and in that case a special callback, using these two is constructed.

#4 @westi
15 years ago

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

(In [9834]) Ensure tag cloud topic(s) tooltips can be translated. Fixes #7989 props nbachiyski.

#5 @nacin
10 years ago

This never actually worked very well because the domain was omitted. I'm trying to handle this in #14424 #27262.

Last edited 10 years ago by nacin (previous) (diff)

#6 @nacin
10 years ago

In 27376:

Accept nooped plurals in wp_generate_tag_cloud() / wp_tag_cloud().

Renders topic_count_text_callback more or less obsolete. It can still be used, but passing a plural is easier.

fixes #27262. see #7989, #14424.

Note: See TracTickets for help on using tickets.