Page MenuHomePhabricator

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

Details

Reference
bz28128

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:25 PM
bzimport set Reference to bz28128.
bzimport added a subscriber: Unknown Object (MLST).

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

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

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.

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

(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.

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.

(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)».

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