Commons group module (commons_groups.module, lines 297-301) uses this code for a count of group conrtibutors text on commons all groups page (path like this: www.sitename.com/groups):

$contributors_count = $view->total_rows;
$output .= l(t('@contributors_count @contributors', array(
  '@contributors_count' => $contributors_count,
  '@contributors' => format_plural($contributors_count, 'contributor', 'contributors'),
)), 'node/' . $group->nid . '/contributors');

But it does not allow to translate a count of contributors text correctly (see this) - it does not need to use t() function, as i understood.

This changed code does work correctly:

$output .= l(format_plural($contributors_count, '1 contributor', '@count contributors'), 
'node/' . $group->nid . '/contributors');

Thanks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fun.boojum’s picture

Issue summary: View changes
Devin Carlson’s picture

Version: 7.x-3.9 » 7.x-3.x-dev
Assigned: fun.boojum » Unassigned
Status: Active » Needs review
FileSize
916 bytes

Good catch!

As you mentioned, format_plural() handles translation itself so passing its output to t() will cause problems.

The attached patch removes the call to t() as is done in the OP.

Devin Carlson’s picture

Status: Needs review » Fixed

Tested #2 with an existing Commons installation and confirmed that the group contributor counts could be translated and continued to function properly with translation disabled.

Committed #2 to Commons 7.x-3.x.

http://drupalcode.org/project/commons.git/commit/a6d2038

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.