Consider whether {{PLURAL:}} should handle fractional numbers
Closed, ResolvedPublic

Description

This comment in the code (for Russian) indicates, that fractional numbers are not really supported by Language::convertPlural() method:

http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/languages/classes/LanguageRu.php?revision=70131&view=markup#l79

Russian, Polish and other slavic languages (and probably many more) use a different form for franctional numbers.

This document:

http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#ru

does not seem to address this.

The only case where we *might* needed is to display amount of the funds donated to the Wikimedia Foundation:

http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/CentralNotice/SpecialBannerLoader.php?revision=83744&view=markup#l126

(not sure if having fractions of millions there is a good idea, if it is not - please WONTFIX this bug).


Version: 1.18.x
Severity: enhancement
URL: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/CentralNotice/SpecialBannerLoader.php?revision=83744&view=markup#l126

bzimport added a subscriber: wikibugs-l.
bzimport set Reference to bz28128.
saper created this task.Via LegacyMar 20 2011, 1:44 AM
saper added a comment.Via ConduitMar 20 2011, 1:50 AM

Example from Polish:

1 milion
2 miliony
3 miliony
4 miliony
5 milionów
6 milionów

44 miliony
44,5 miliona
44,7 miliona

but things get nasty, if counting for example people:

44,5 milinów ludzi

Source in Polish: http://poradnia.pwn.pl/lista.php?id=9817

Nikerabbit added a comment.Via ConduitMar 20 2011, 9:38 AM

Looks like it's impossible to get right without externally provided context.

saper added a comment.Via ConduitMar 20 2011, 10:42 AM

Well, dealing with the context is simple, you just provide appropriate parameters to PLURAL in a message (example syntax):

{{PLURAL|milion|miliony|milionów|NOFRACTIONAL}} ludzi (for people)

{{PLURAL|milion|miliony|milionów|miliona}} dolarów (for dollars)

Do we want to add additional plural form (or maybe forms, and how many?). This will be implemented on a per-language basis anyway. We currently have 44 languages with specific plurals, with ar, gd and cy having 6 forms, and most of the Slavic languages having 3-4 plural forms.

Nikerabbit added a comment.Via ConduitMar 20 2011, 11:04 AM

Hmm you're right. CLDR says that one parameter for fractions is enough in Russian, is that true?

ajvol added a comment.Via ConduitJan 31 2012, 8:51 AM

(In reply to comment #4)

Hmm you're right. CLDR says that one parameter for fractions is enough in
Russian, is that true?

Russian fractions are always $forms[1] ("other"="few" in CLDR terms).

But if you write part of number as word (e.g. "million" in the Polish example above), the plural problem becomes more complicated.

Nikerabbit added a comment.Via ConduitSep 16 2012, 4:45 PM

Since we switched to CLDR which *can* take fractions into account, I consider this fixed. It of course depends on the supplied rules for a language how it works.

Nemo_bis added a comment.Via ConduitSep 24 2012, 7:07 AM

(In reply to comment #6)

Since we switched to CLDR which *can* take fractions into account, I consider
this fixed. It of course depends on the supplied rules for a language how it
works.

Does this mean that this sentence can be removed from [[mw:Localisation]]? «You should not expect PLURAL to handle fractional numbers (like 44.5), so it's probably a good idea to round the number to the nearest integer if PLURAL is necessary in the context (bugzilla:28128)».

Nikerabbit added a comment.Via ConduitSep 24 2012, 4:41 PM

Yes, but like I said I don't expect all our plural rules to be perfect yet in that regard.

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.