Version: (using KDE KDE 3.4.2) Installed from: Debian testing/unstable Packages My request is the addition of a method to class KLocale that returns the currency code (iso 4217, 3 letters), of the current default currency.
Which applications (note the plural) have the need for this, now?
KMyMoney is the first application that would use it. I don't know whether there are others. Here's how KMyMoney would use it: KLocale[1] provides a currencySymbol() interface, but this only gives the symbol for presentation to the user, e.g., "$". The C library locale(7) interface provides this as well (lconv.currency_symbol), but it also provides the three-character ISO 4217 currency code[2] in lconv.int_curr_symbol. KLocale::currencySymbol() is enough for most applications, but KMyMoney also needs the ISO 4217 code. Most currencies use a fractional unit of 0.01, but some use 0.001, and we need the ISO 4217 code to determine the correct value. KMyMoney *could* use the C library localeconv(3) directly, but the information returned depends on the LC_ALL, LC_MONETARY, or LANG environment variables, which don't seem to be connected to KDE's idea of the current locale. (This disconnect seems like a major user experience problem in itself, but I have no idea how to address it). [1] http://developer.kde.org/documentation/library/3.3-api/kdecore/html/classKLocale.html [2] http://www.iso.org/iso/en/prods-services/popstds/currencycodeslist.html
To comment #1: KSpread could probably use it too.
Just for the archive: add a reference to the iso-codes discussion thread on kde-i18n-doc
On the basis that at least KMyMoney, KSpread, and KExchange could use this, I'm planning to add support for this in 4.3. I think this would best be done using separate .desktop files in a new sub-directory. There would be a single .desktop file per currency code (e.g. USD.desktop) with fully translatable values inside. The 110l .desktop file would then have a new value for CurrencyCodes which would operate the same as the Languages variable allowing a locale to have multiple currencies associated with it. The locale .desktop files will no longer store the other currency details but KLocale will look up the selected currency code .desktop file instead. In the KCM the user will be able to select any currency code they want which will cause the .desktop default values to be loaded, but the user will still be able to override the values locally. I intend to support the following values: Currency Code Currency Name Currency Major Unit Symbol Currency Major Unit Symbol Unambiguous Currency Minor Unit Symbol Currency Subunits Currency Major Unit Name Singular Currency Major Unit Name Plural Currency Minor Unit Name Singular Currency Minor Unit Name Plural An example would be: USD United States dollar $ US$ ยข 100 dollar dollars cent cents I am currently compiling the list of values from Wikipedia and other public sources. If there is anything else you think needs supporting please let me know. John.
I now have a proposed design for this posted at http://techbase.kde.org/Projects/kdelibs/localisation#ISO_4217_Currency_Code_Support and an initial implementation on reviewboard at http://reviewboard.kde.org/r/2049/ . This should hopefully go into KDE 4.4.
Implemented for KDE4.4 in KLocale to return users chosen currency code and currencies used in current locale, and in new class KCurrencyCode which provides a list of all supported codes, decimal places, countries using currency, etc. See commit 1054361. See apidox at http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKCurrencyCode.html