Project:User Points
Version:6.x-1.x-dev
Component:Code: userpoints API
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

it was an issue #196111: Translation for term "User Points for drupal 5.
It reproduces in 6.x-1.0 version - it is impossible to use russian plural forms.

Comments

#1

subs

#2

Version:6.x-1.0» 6.x-1.x-dev

I have no idea how to fix this. Can you or someone else create a patch and a few people test it?

#3

Title:6юч plural form for "!Points"» 6.x plural form for "!Points"

Corrected issue title.

#4

We used thid code in our project

<?php
function userpoints_plural_stub_userpoints($op$params = array()) {
  switch (
$op) {
    case
'points after':
     
// number
     
$count = $params['points'];
      if (
$count!==0) {
       
// now have
       
$sum = userpoints_get_current_points($params['uid'], $params['tid']);

       
// placeholders
       
global $user;
       
$user_pointed = user_load($params['uid']);
       
$subst = array(
         
'@count' => format_plural(abs($count), '@count userpoint', '@count userpoints'),
         
'@sum' => format_plural($sum, '@count userpoint', '@count userpoints'),
         
'@user' => $user_pointed->name,
        );
       
// @@@ TODO: add userpoints category to the output.
       
$subst = array_merge(userpoints_translation(),$subst);
       
// formst output
       
if ($user->uid == $params['uid']) { // own points
         
if ($count > 0) {
           
drupal_set_message(
             
t('You gained @count and now you have @sum.', $subst)
            );
          }else{
           
drupal_set_message(
             
t('You lost @count and now you have @sum.', $subst)
            );
          }
        } else {
// other user's points
         
if ($count > 0) {
           
drupal_set_message(
             
t('User @user gained @count and have @sum now.', $subst)
            );
          }else{
           
drupal_set_message(
             
t( 'User @user lost @count and have @sum now.', $subst)
            );
          }
        }
       
      }

      break;
    case
'setting':
     
// plurals
     
$group = 'plural_messages';
     
$form[$group] = array(
       
'#type'        => 'fieldset',
       
'#collapsible' => TRUE,
       
'#collapsed'   => TRUE,
       
'#title'       => t('Fixed plural messages'),
       
//'#description' => t('How much !points...', userpoints_translation()),
     
);
     
$form[$group][URS_VARIABLE_PLURAL] = array(
       
'#type'        => 'checkbox',
       
'#title'       => t('Enable plural messages'),
       
'#return_value'  => 1,
       
'#default_value' => variable_get(URS_VARIABLE_PLURAL, 0),
       
'#description' => t('Show true plural messages when !points are gained or lost', userpoints_translation()),
      );
      return
$form;
      break;
  }

}
?>

#5

subscribing - can someone create a patch to be reviewed?
thanks!

#6

.

#7

From the old issue falsdaf linked to, it seems this should have been fixed in 5.x-dev. Why did it not make it to 6.x?

I just made a patch for http://drupal.org/node/284609 dealing with the same code. I wish I had known about format_plural() at the time. :-)

#8

#9

subscribing

#10

+1 subscribing

#11

Status:active» needs review

Is #4 to be reviewed? I am not sure where it should go, but supporting plural form for !points would be awesome!

#12

Status:needs review» closed (duplicate)

No, not really. That is solving it with a separate module, to really fix it, it would need to be a patch against 6.x.

Here is what we did for 7.x: #872238: Improve Message Syntax When Points Are Awarded

The problem is that this would obviously result in string changes, and that is discouraged for stable versions, because it would break all existing transations on sites which are already using it.

Anyway, I think that issue here can be closed as duplicate of the linked one. (And a few other issues in the queue too)

nobody click here