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.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | userpoints.module.plurals.patch | 1.51 KB | tuffnatty |
Comments
Comment #1
vladsavitsky commentedAlso 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.
Comment #2
jredding commentedCan 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.
Comment #3
tuffnatty commentedjredding,
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.
Comment #4
jredding commentedoh 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).
Comment #5
tuffnatty commentedHere is a patch regarding format_plurals() against 5.x-3.5.
Comment #6
kbahey commentedThank you. Committed.
Should be in -dev in about 24 hours.
Comment #7
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.