Last modified: 2012-09-24 16:41:55 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T30128, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 28128 - Consider whether {{PLURAL:}} should handle fractional numbers
Consider whether {{PLURAL:}} should handle fractional numbers
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Internationalization (Other open bugs)
1.18.x
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
http://svn.wikimedia.org/viewvc/media...
: i18n
Depends on:
Blocks: plural
  Show dependency treegraph
 
Reported: 2011-03-20 01:44 UTC by Marcin Cieślak
Modified: 2012-09-24 16:41 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Marcin Cieślak 2011-03-20 01:44:04 UTC
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).
Comment 1 Marcin Cieślak 2011-03-20 01:50:23 UTC
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
Comment 2 Niklas Laxström 2011-03-20 09:38:41 UTC
Looks like it's impossible to get right without externally provided context.
Comment 3 Marcin Cieślak 2011-03-20 10:42:58 UTC
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.
Comment 4 Niklas Laxström 2011-03-20 11:04:38 UTC
Hmm you're right. CLDR says that one parameter for fractions is enough in Russian, is that true?
Comment 5 Alexander Sigachov 2012-01-31 08:51:14 UTC
(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.
Comment 6 Niklas Laxström 2012-09-16 16:45:44 UTC
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.
Comment 7 Nemo 2012-09-24 07:07:31 UTC
(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)».
Comment 8 Niklas Laxström 2012-09-24 16:41:55 UTC
Yes, but like I said I don't expect all our plural rules to be perfect yet in that regard.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links