WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 12 months ago

#7989 closed defect (bug) (fixed)

Translate "topic/topics" in the tag cloud

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

Description

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 6 years ago.
tag-cloud-topics-text-i18n.diff (3.4 KB) - added by nbachiyski 6 years ago.

Download all attachments as: .zip

Change History (8)

@msi086 years ago

comment:1 @ryan6 years ago

ngettext() still needs to be removed.

comment:2 @markjaquith6 years ago

  • Owner changed from anonymous to ryan

comment:3 @nbachiyski6 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.

comment:4 @westi6 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.

comment:5 @nacin12 months ago

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

Last edited 12 months ago by nacin (previous) (diff)

comment:6 @nacin12 months 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.