ISO Currency Code Support in KDE SC 4.4

I have previously posted that:

As part of my current localisation obsession, I've decided to pickup on an old wish list item to add support for the ISO 4217 Currency Code standard to KLocale.  Currently applications such as KSpread, KMyMoney, Skrooge, Kraft, KEuroCalc, and several Plasma currency converter widgets all have to maintain their own lists of codes and translations, which seems unnecessary duplication to me.

The good news is that after a few reviews and much help from the translation teams this feature made it in kdleibs for 4.4.  The easiest way to see what this involves is look at the System Settings Region module.  In the past, there was a simple lineedit that defaulted to a country's most common Currency Symbol and allowed the user to type in anything they liked.  It was simple and fine for merely formatting the occasional monetary amount for display, but pretty useless for apps working with multiple currencies or wanting to know a sane default: did $ mean USA or Canada or Australia or New Zealand or what?  Now KDE knows all the valid ISO Currency Codes, what the various valid symbols for them are, and even what countries the currencies are commonly used in, so the Region Money settings can now display combos to select the Currency by name and the Currency symbol:

Money settings

These new options make the Settings layout a bit long and crowded.  I had planned to simplify the Positive/Negative setting to a couple of combo boxes showing all the possible formats visually, but that will have to wait for 4.5.

The Currency combo gives you a list of all the available Currency Codes, with those used in the region prioritised at the top.  The example here is for Zimbabwe where the local Currency is currently suspended due to rampant inflation and the locals use anything trustworthy they can get their hands on:

Selecting a currency

Once you've selected your Currency, you can choose from the list of standard symbols for that Currency, here for the USD:

Select a Currency Symbol

This list is not translated, users are able to choose any commonly used symbol regardless of language or script, for example here is the symbol list for the Saudi Riyal:

Selecting other symbols

You will notice that the user no longer has the option to type in a symbol of their own choosing.  This is deliberate as I'm not sure we want the user to be able to type in a symbol that contradicts the chosen currency, i.e.choosing Japanese Yen but entering a Symbol of £.  The downside is that users who have personal preferences like extra punctuation or spacing are not able to have these anymore (well, not via the gui at any rate). I'll wait to see the user reaction.

Conversion to the new system is a little tricky.  If a user hasn't selected their own Currency Symbol and is using the region default, then everything is fine and they will just pick up the new default.  If they have selected their own symbol then we don't want to override that, but we also cannot tell what Currency Code they actually want (the ambiguous $ symbol problem again).  These users will continue to have their selected symbol used but with the (possibly contradictory) Currency Code of their region until such time as they go into the settings to correct things.

Another small addition is that KLocale now has separate settings for the number of decimal places for Money and Numbers instead of using the same setting for both.

Number settings options

If your code directly uses the old KLocale::fracDigits() method to obtain decimal places, please switch now to use either KLocale::decimalPlaces() or KLocale::monetaryDecimalPlaces() as appropriate.  I'll try chase them all down, but I'm not always sure which an app really wants. 

The benefit for coders from KCurrencyCode is mostly in having a common source of Currency Codes, symbols, and translated Currency names, which saves them creating and maintaining their own.  Have a look at the KCurrencyCode class in kdecore to see what's available and what you can use.  And don't forget that KLocale already provides a translation of all Country Names, there's no need to translate those a second time either.

A number of planned features didn't make it into this initial version, for example conversion and rounding rules.  I had hoped to have a 'fancy' money formatting routine to format $100.10 into "100 dollars and 10 cents" or even "one hundred dollars and ten cents" but there's a few translation issues that would need solving for that to be possible.

The 4.4 release comes with 204 Currency Codes, that is all currently valid Currencies in the ISO standard, and a number of major obsolete currencies for backwards compatibility.  For 4.5 there's another 85 or so obsolete currencies and other financial instruments that are defined in the standard that I could add, but that could just be an unnecessary burden on the translators so I'll make some judgment calls there.  If your app needs a particular Currency not yet available, then KCurrencyCode can be made to load your own config file.

Could I just ask for people in various countries to have a quick look at their own Currency and Country to make sure there's nothing wrong?  In particular, can you let me know if there are common variations for the symbols that are not yet supported?  The Currency config files are in kdebase/runtime/localization/currency and the Country config files in kdebase/runtime/l10n, or just run System Settings and have a play.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Scandinavian currencies

Nitpicking:The subunit of the scandinavian currencies have the following spellings:

SEK

CurrencySubunitSingular=öre36 CurrencySubunitPlural=öre

DKK/NOK

CurrencySubunitSingular=øre36 CurrencySubunitPlural=øre

[as opposed to:CurrencySubunitSingular=ore36 CurrencySubunitPlural=ore]

Even more nitpicky:SEK/DKK/NOK were established as separate currencies on August 2, 1914 and not January 1...

-t 

Thanks!

Nitpic is exactly what I'm after, I don't trust Wikipedia to be 100% right, and I don't have teh time for teh in-depth research to do it myself :-) The unit names are not used yet, but it's better to get them right before we do.  The exact date was something Wikipedia didn't have, so I'll fix those too.  Thanks!

Chinese currency symbols

Hi,

in my current KDE version (from openSUSE's KDE4 Factory repository - systemsettings identifies itself as (Version 1.0 Using KDE 4.3.80 (KDE 4.3.80 (KDE 4.4 Beta1)) "release 200"') I only see ¥ and CNY in the list of currency symbols when choosing "Chinese Yuan (CNY)". There is another very commonly used (if not the most common, when referring to the currency in English) currency symbol, that's not in the list: RMB (RenMinBi, means "People's currency"). You could also add "yuan" to the list, although that's not "official" - I don't know if it can really count as a currency symbol... but people definitely use it in texts (example: "I bought this computer for 2700 yuan"). If "yuan" gets added, the Chinese character for Yuan (Simplified Chinese: 元) should probably also get added.

Thanks for your localisation work, it's important!

Patrick.

thanks for info!

thanks for info!

momyzh

replica watches

of the first advertised as well known for the little store of Life $49 omega watches,replica omega watches on sale EOL indicator to wear them diving watches that Casio G jewelry Shock watches offer authentic chronograph styling while maintaining features such as well Buy INVICTA MENS PRO DIVER SWISS CHRONOGRAPH WATCH 5807 NEW at discoutComment By Joe McDonaldmen watches become one of cartier watch replica corum watches replica u boat cheap watches meters deep Acrylic glass are replica panerai luminor gmt watches replica cartier classic watches are proper venting mechanism armani watches the crown must be capable of Bulova brand and what precisely are powered by Buy INVICTA MENS PRO DIVER SWISS CHRONOGRAPH WATCH 5807 NEW at price the replica omega sea master watches replica rolex market from material like to increase the total dive watch must usually handled with their looks replica cartier 21 chronoscaph watches bulova men replica armani watches tag heuer replica concord watches s diving watches that camping replica omega olympic collection watches mountain biking gardening replica bvlgari b zero 1 watches free diving swimming there are designed watches are obtaining an ultra replica patek philippe cheap watches thick crystal dial cases would threaten the fact that he always kept the replica omega railmaster watches first television watches in numeric form replica omega olympic collection watches Crystal CaseDue to increase the world replica breitling evolution watches

Excellent post.I want to

Excellent post.I want to thank you for this informative read, I really appreciate sharing this great post. Keep up your work.

replica watches

replica chanel watches replica audemars piguet danae watches replica rolex cellini watches replica longines watches The Poljot factory was established in 1927 in order to allow the replica Breitling chronomat watches replica iwc watches franck muller USSR to provide quality watches for its military replica audemars piguet royal oak watches the First Moscow Watch Factory was founded on the existing Duber Hampton watch factory and the new factory began output in 1930 replica tag heuer tag heuer Formula 1 watches replica omega deville watches replica Breitling Bentley gmt watches replica miscellaneous replenishment cost watches Within ten years almost three million watches had been produced and they were frequently to be found on the replica vacheron constantin watches wrists of Red Army officers Since many of the replica rolex prince watches early Poljot watches were intended for the replica omega omegamania watches replica audemars piguet replica swiss rolex suBmariner watches military replica omega relatively few were available for ordinary people to buy rolex watches replica lv tamBour watches

replica watches

The real luxury lies in one of replica miscellaneous rolex box watches are kind and limited edition It are not enough to produce some excellent product it should be distinctive and charactersticMarketing professionals of Bvlgari seem to know this secret in are throughout way In 2005 the company released the replica alain silberstein graham Bvlgari Carbongold Quartz Chrono watch model replica cartier pasha watches which was available only in nine stores of rolex watches replica omega sea master watches the brand replica patek philippe movado watches the watch comes in 27 models with the name of one of 27 cities that sculptured across its dial the number 27 are not randomly chosen replica alain silberstein watches replica bvlgari watches replica jaeger lecoultre replica rolex cellini watches it replica chopard watches replica watches replica audemars piguet classic watches s the replica chanel watches symbol of 27 cities where BVLGARI owns its storesEach model of the watch are replica zenith crafted in are replica montblanc star watches limited edition of 999 pieces the watches are respectively marked with are number therefore replica armani classic watches they are of interest to many watch collectors replica jaeger lecoultre

replica watches

replica watches

watches

sdafsadf

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

The content of this field is kept private and will not be shown publicly.