Review Request 126476: Make it possible to use doubles as index for i18np*() calls

Chusslove Illich caslav.ilic at gmx.net
Wed Dec 23 13:27:28 UTC 2015



> On Дец. 23, 2015, 8:24 пре п., Alexander Potashev wrote:
> > Test question: should it be "1.5 other windows" or "1.5 other window"?
> > 
> > The code in this patch seems to truncate the double to an integer and then use the appropriate plural form for the integer. But, for example, in Russian "5.4 billion" is read as "five and four tens of a billion" where instead of "of a billion" we actually put "billion" in genitive case. Thus for fractions the proper plural form will always be the same, independent of their values.

The way I understood, the problem here is that an argument that was intended to be an int can be converted "unexpectedly" to double in QML, where "unexpected" is in the sense of less predictably/differently/unavoidably compared to C++. E.g. instead of an intended value of 42 the methods get 42.0. This is the case that the patch is trying to handle, and not to introduce plurals for intentional doubles.

But, of course, if a programmer misunderstands the intended usage of plurals, this patch would also make intentional doubles be used for plurals. So I look at it as the lesser of two evils, enabling wrong use of plurals vs. not being able to use plurals at all.


- Chusslove


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/126476/#review89968
-----------------------------------------------------------


On Дец. 23, 2015, 1:53 по п., Aleix Pol Gonzalez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/126476/
> -----------------------------------------------------------
> 
> (Updated Дец. 23, 2015, 1:53 по п.)
> 
> 
> Review request for KDE Frameworks and Chusslove Illich.
> 
> 
> Repository: ki18n
> 
> 
> Description
> -------
> 
> Also considers double values to check for plurals.
> 
> In QML it's hard to ensure a value is an integer and we'd get unreliable results, e.g. `i18nd("%1 thing", "%1 things", 3-i)`.
> 
> Also it creates a separate function to reuse some code.
> 
> 
> Diffs
> -----
> 
>   autotests/ki18ndeclarativetest.cpp cf8e778 
>   autotests/test.qml 314b516 
>   src/klocalizedcontext.cpp 3bc42dd 
>   src/klocalizedstring.cpp 69950d2 
> 
> Diff: https://git.reviewboard.kde.org/r/126476/diff/
> 
> 
> Testing
> -------
> 
> Added new tests, which now pass.
> 
> 
> Thanks,
> 
> Aleix Pol Gonzalez
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20151223/9ef46055/attachment.html>


More information about the Kde-frameworks-devel mailing list