Translation for term "User Points

VladSavitsky - November 28, 2007 - 19:47
Project:User Points
Version:5.x-3.x-dev
Component:User interface
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

You have done a very powerful tool. Thanks!

At configuration page (admin/settings/userpoints) I see a "Points branding". Here I can translate a word "Points" to whatever I want. But in russian (and ukrainian) language we have 3 plural forms... It's only 2 in english

This is my string for plurals from KBabel:
nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);

I just started translation to russian of all module. You have done a very good feature and I'll use it if it posible. Thanks.
You're doing a very useful modules and clear code.

#1

VladSavitsky - November 28, 2007 - 20:09

Also in russian each word has a many endings...
Is it posible to do a plurals within a PO-file. I have seen this in other modules.
This is very flexible solution. Each language has he's own number of plurals and other rules.
Thanks.

#2

jredding - December 28, 2007 - 03:57

Can you provide a listing of the modules that provide this type of functionality. I don't speak Russian so its pretty hard for me to wrap my head around how this is supposed to work.

#3

tuffnatty - June 4, 2008 - 12:28
Version:5.x-2.14» 5.x-3.5
Status:active» needs review

jredding,

Here is the listing you asked for:

http://api.drupal.org/api/function/format_plural/6/references

Here are the docs for the function you need:

http://api.drupal.org/api/function/format_plural/6

Currently (5.x-3.5) it is used incorrectly in userpoints.module. Please notice from the docs:
"Since t() is called by this function, make sure not to pass already-localized strings to it."

I think you should change this:

$show_points = format_plural($points, t('!point', userpoints_translation()), t('!points', userpoints_translation()));
$content = t('You have %p %c', array('%p' => $points, '%c' => $show_points));

to this:

$content = format_plural($points, 'You have 1 !point', 'You have @count !points', userpoints_translation());

And probably something like this in some other places where !points are mentioned.

#4

jredding - June 4, 2008 - 13:20

oh so format_plural is all that is needed to handle Russian, cool. From the conversation it sounded as if more was needed. I think this can definitely be worked in give it sometime though unless you can submit a patch. (you've already written the code, a quick patch will get it into the module really quick).

#5

tuffnatty - June 13, 2008 - 01:05

Here is a patch regarding format_plurals() against 5.x-3.5.

AttachmentSize
userpoints.module.plurals.patch 1.51 KB

#6

kbahey - June 13, 2008 - 02:39
Version:5.x-3.5» 5.x-3.x-dev
Status:needs review» fixed

Thank you. Committed.

Should be in -dev in about 24 hours.

#7

Anonymous (not verified) - June 27, 2008 - 02:42
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.