KLocalizedString regression

Chusslove Illich caslav.ilic at gmx.net
Fri Mar 25 13:19:15 GMT 2011


> [: John Tapsell :]
> 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?

Well, yes. Two grammar-wise different text fragments (enumerable vs.
measurable quantities) are being used in alternation, so each should be
represented by its own string. The author of KUnitConversion wanted the same
feature, so there too we ended up defining two strings, e.g:

      setDefaultUnit(UP(Meter, 1,
        ...
        ki18nc("amount in units (real)", "%1 meters"),
        ki18ncp("amount in units (integer)", "%1 meter", "%1 meters")
      ));

(from kdelibs/kunitconversion/length.cpp).

In my opinion, however, this alternation is bad style-wise. The display
should use either the measurable form throughout (2.0 seconds; 2.2e4
seconds), or the enumerable form throughout (2 seconds; 6 hours 6 minutes).

-- 
Chusslove Illich (Часлав Илић)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20110325/b2b28835/attachment.sig>


More information about the kde-core-devel mailing list