Opened 7 years ago

Closed 7 years ago

#3244 closed defect (bug) (fixed)

tiny i18n fix

Reported by: mamay Owned by: markjaquith
Priority: lowest Milestone: 2.1
Component: General Version: 2.0.4
Severity: normal Keywords: has-patch
Cc:

Description

comments_number function is not outputting internationalized strings.

Attachments (5)

comment-i18n.diff (214 bytes) - added by mamay 7 years ago.
comment_number_i18n.diff (921 bytes) - added by markjaquith 7 years ago.
Patch for trunk
comment_number_i18n_2.diff (893 bytes) - added by markjaquith 7 years ago.
Updated, with Masquerade's help
comment_number_i18n_3.diff (916 bytes) - added by markjaquith 7 years ago.
third try... more meaningful variable name, removed $comment as global
comment_number_i18n_4.diff (1.2 KB) - added by markjaquith 7 years ago.
Only pass default strings through gettext

Download all attachments as: .zip

Change History (9)

mamay7 years ago

I believe it is assumed that the inputted strings are already internationalized.

  • Owner changed from anonymous to markjaquith
  • Status changed from new to assigned

Hm, don't think so. And for more than one, we need to use __ngettext()

See patch. I also re-ordered the logic, removed the last test (after all, if a positive integer isn't greater than one, and isn't zero, it MUST be one), and passed the number of comments to the filter at the end, to make it easier for plugin authors to use the filter (no need to preg_match() the number).

Patch for trunk

Updated, with Masquerade's help

third try... more meaningful variable name, removed $comment as global

comment:3   ryan7 years ago

Passing variable strings to ngettext() is sketchy. The variable names can end up in the catalog.

Only pass default strings through gettext

comment:4   ryan7 years ago

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

(In [4494]) i18n fix for comments_number(). Props Mark Jaquith. fixes #3244

Note: See TracTickets for help on using tickets.