KLocalizedString regression

John Tapsell johnflux at gmail.com
Fri Mar 25 12:59:16 GMT 2011

On 25 March 2011 12:45, Chusslove Illich <caslav.ilic at gmx.net> wrote:
>> [: John Tapsel :]
>>   ki18ncp("Units", "%1 second", "%1 seconds").subs(1.1, 0, 'f', 1).toString()
>> used to work (return "1.1 seconds") but now it returns ("1.1
>> seconds(I18N_PLURAL_ARGUMENT_MISSING)") which screws up my graphing
>> widget.
> This is the way it (should have) always worked. The plural call expects to
> get an integer, and if does not, it shows this warning (in debug build, not
> in release build).

That's not good :-(

If the number is small, I want to show   "2 seconds"   but if it's
large I want like "2.2e4" seconds.

You're saying that my API needs to require the user to now pass *two*
strings for that?

> On the language level, plural declination kicks in only on integer values,
> while real values always get plural form. This seems to hold for all
> languages currently known in KDE. In English, all of "1.0 seconds",
> "1.1 seconds", "1.3 seconds", and "2.3 seconds", are (?) both correct and
> expected forms, as opposed to "1 second" and "2 seconds".

And that's fine.  So do that.  But don't stick a big warning there!

If I specify a precision of 0, then it should be   "1 second".  If the
precision is "1" then "1.0 seconds" is fine.


More information about the kde-core-devel mailing list