Bug 117506 - ISO 4217 currency codes
Summary: ISO 4217 currency codes
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: klocale (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR wishlist
Target Milestone: ---
Assignee: John Layt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-02 13:00 UTC by mvillarino
Modified: 2009-11-29 17:23 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mvillarino 2005-12-02 13:00:36 UTC
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.
Comment 1 Thiago Macieira 2005-12-02 13:48:37 UTC
Which applications (note the plural) have the need for this, now?
Comment 2 Bjorn Helgaas 2005-12-02 17:09:27 UTC
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
Comment 3 Nicolas Goutte 2005-12-02 22:26:21 UTC
To comment #1: KSpread could probably use it too.
Comment 4 Nicolas Goutte 2006-03-05 22:24:36 UTC
Just for the archive: add a reference to the iso-codes discussion thread on kde-i18n-doc
Comment 5 John Layt 2008-12-07 16:03:57 UTC
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.
Comment 6 John Layt 2009-11-02 23:53:01 UTC
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.
Comment 7 John Layt 2009-11-29 17:23:54 UTC
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