This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mdk
Recipients Tim.Graham, loewis, mdk, serhiy.storchaka, xiang.zhang
Date 2016-12-04.10:42:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1480848145.95.0.2473286983.issue28692@psf.upfronthosting.co.za>
In-reply-to
Content
> But gettext formulas are not purposed to support non-integer values and can return incorrect result

Looks like the cast to integer is done *before* giving the value to the C gettext expression.

> For example (in Ukrainian)

As long as gettext expression don't support non-integer values, there exist *no* way to support two languages where plural form differ for non-integer value. Typically if a language A consider 1.5 to be singular and another language B consider 1.5 to be plural, the only place in the code that can make the difference IS in the C plural expression which don't support non-integer values.

Rouding the value before giving it to ngettext only fixes the issue for the lang of the current developer, as for other languages, translators won't be able to change the rounding properties.

But should we bet that in most, any, or all languages, 1.5 is considered plural? I think so, according to wikipedia¹: "Plural of nouns typically denote a quantity other than the default quantity represented by a noun, which is generally one."

So, I think that a better fix than warning for non-integer values may be to round them using math.ceil instead of round. This way we avoid developpers to drop round() everywhere to fix the warning the wrong way, leaving the same bug you're having in Ukrainian.

¹: https://en.wikipedia.org/wiki/Plural
History
Date User Action Args
2016-12-04 10:42:25mdksetrecipients: + mdk, loewis, serhiy.storchaka, Tim.Graham, xiang.zhang
2016-12-04 10:42:25mdksetmessageid: <1480848145.95.0.2473286983.issue28692@psf.upfronthosting.co.za>
2016-12-04 10:42:25mdklinkissue28692 messages
2016-12-04 10:42:25mdkcreate