[Kde-finance-apps] Porting KLocale::formatMoney()/readMoney() to Qt5/KF5, best practise?

John Layt jlayt at kde.org
Wed Jan 6 10:07:55 UTC 2016


On 6 January 2016 at 07:12, Friedrich W. H. Kossebau <kossebau at kde.org>
wrote:

>
> QUESTIONS
>
> How have developers of e.g. Skrooge & KMyMoney approached the issue of
> conversion of currency values to/from strings?
>
> Do you know about any activities to improve QLocale here?
>

Hi Friedrich,

Apologies that the new QLocale features are taking so long, but it's
proving very hard to find an acceptable cross-platform solution that isn't
dumbed-down to the lowest feature set (i.e. Win32) and therefore useless to
us. I've just started working on Plan D [1], each of the previous plans
representing 3-6 months work before getting shot down. If this plan
survives the inevitable savaging on the qt-dev mailing list then I'm hoping
it will make the Qt 5.8 release, so perhaps a year before you could really
use it.

In the interim I'd suggest using ICU, seeing as the plan for Qt on Linux
will be to wrap ICU anyway. It's not a pretty api, but it has all the
features you want and you can rely on it being packaged everywhere. The
main problem to watch out for is that there is no binary compatibility
guarantee on the C++ api, so to be safe it's better to use the C api, but
that unfortunately has fewer features available.

To save you some work, I do have an old draft implementation of the new
QNumberFormatter class at [2], it works on ICU and Mac but the api is a bit
outdated now. If you're happy to wait a week or two I'll have a new version
of the draft api and test ICU implementation completed which now includes a
proper QCurrencyFormatter class which you could copy.

The other area still needing work is replacing KCurrencyCode for general
data look-up tasks. I'd like to get a Qt version of it, but I'm doubtful it
will make it in to Qt as Win32 doesn't provide the required data or api and
I'd need to convince Qt that including all the data would be worth it. It's
an area I'm still researching.

John.

[1] https://wiki.qt.io/Locale_Support_in_Qt_5
[2]
https://github.com/jlayt/qtbase/commit/e9c626cd2425f5e1e37cf0fdc9b8a44d59e0e416
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-finance-apps/attachments/20160106/c80dc953/attachment.html>


More information about the Kde-finance-apps mailing list