Julien Palard added the comment:

> 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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28692>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to