Qalculate / qalculate-gtk

Qalculate! GTK+ UI
https://qalculate.github.io/
GNU General Public License v2.0
949 stars 69 forks source link

Improvement to currency list #52

Closed majumeke closed 3 years ago

majumeke commented 6 years ago

Hello, i'm enjoying the vast amount of features in Qalculate! what a great program.

i have a request to make, can you modify the currency list so that all countries have their currency units ? as it is only a few have their full definition(Indian Rupee, Danish Kroner, Swedish Krona, etc) while the majority of currencies are listed by the countries they are used in(Algeria, Benin, Cuba, etc) or alternately could you show me how to modify this information myself ?

Thank you and keep up the great work on Qalculate.

hanna-kn commented 6 years ago

Each currency needs an entry such as this

<builtin_unit name="DKK">
  <_title>Danish Kroner</_title>
  <_names>ar:DKK</_names>
</builtin_unit>

in definitions/currencies.xml.in (in the source code) or, without the underscores, in currencies.xml (located in $PREFIX/share/qalculate/ on GNU/Linux).

For currencies with a specific non-conflicting symbol and name, this can specified similar to <_names>ar:JPY,au:&#xA5;,yen</_names>.

The reason this has not been done yet, is simply that it requires boring tedious work.

majumeke commented 6 years ago

Thank you for the instructions. will try to modify the files with all currency information, at least it should only be done at least once.

majumeke commented 6 years ago

ok, have updated the file to the best of my ability. here is the updated file currencies.zip it is my hope that after you review it you'll update Qalculate! with it.

a few observations:

hanna-kn commented 6 years ago

I've merged your changes, with some modifications (primarily removal of conflicting names), to the git repository.

majumeke commented 6 years ago

thank you for the merge and the clarifications, the currency list looks much cleaner now. also another question/request. is it possible to add country flags to the currency list ? if possible please guide me on how to add the flags to the list i edited.

hanna-kn commented 6 years ago

Icons (country flags) cannot be added by editing the XML file.

If you could provide an image file (preferably png) for each flag, with the currency code as file name, it should be possible for me to add the icons to qalculate-gtk using a little bit of code. Currencies used by multiple countries would be problematic.

shirishag75 commented 6 years ago

yup, the first which comes to mind is the Euro :)

hanna-kn commented 6 years ago

yup, the first which comes to mind is the Euro :)

It should not be a problem to find an appropriate flag for the Euro, but I'm not so sure about the West and Central African CFA francs.

majumeke commented 6 years ago

the images with the currency codes as file names are attached. for the tricky countries: Chad, Togo, Dominica, etc i've named the files in this format: Country(Currency Code). hopefully you can come up with a workaround for these countries.

Flags.zip

images are from:

majority of the flags: http://flaglane.com/category/countries-a-to-z/ european flag: https://europa.eu/european-union/about-eu/symbols/flag_en all others were from Wikipedia for those that were missing from Flag Lane

hanna-kn commented 6 years ago

The flag images have now been added to the GUI.

For now I've chosen to not use any flag for ANG, XAF, XCD, XOF (as well as obsolete currencies).

majumeke commented 6 years ago

very nice. i've attached the flags for countries with obsolete currencies(for reference)

Flags(Obsolete).zip

hanna-kn commented 6 years ago

I've now added the flags for the obsolete currencies. I've also added flags for ANG, XAF, XCD, XOF. For ANG I combined placed the two flags side by side in the icon, and for the other three I used the symbol of the corresponding monetary organisation.

majumeke commented 6 years ago

again, Thank you. now no one is left behind.

another improvement to the currency list would be to enable a user to search the list using the country name, currency name as well as the currency code in both lowercase and uppercase. ideally, this would also apply to tricky countries such as Chad with its XAF code so that a user does not have to know Chad's currency code(XAF) to make a conversion. they would only have to enter Chad/chad for XAF to appear in the selection menu; bonus feature would be to have Chad's flag shown as well.

hanna-kn commented 6 years ago

another improvement to the currency list would be to enable a user to search the list using the country name, currency name as well as the currency code in both lowercase and uppercase. ideally, this would also apply to tricky countries such as Chad with its XAF code so that a user does not have to know Chad's currency code(XAF) to make a conversion. they would only have to enter Chad/chad for XAF to appear in the selection menu; bonus feature would be to have Chad's flag shown as well.

Done (for conversion list).

The unit manager still needs some updates

majumeke commented 6 years ago

lovely, i really appreciate your dedication to making an already excellent software better. Thank you.

majumeke commented 6 years ago

just installed version 2.5.0 and the currency list looks much cleaner now, Thank you.

would you consider these other improvements as well ?

could the country flag be displayed in the entry box as well ? such that when "dollar to euro" is entered their flags will be displayed in the box in front of their names.

it would also be great to have the flags appear in the suggestion popup when a currency/country is being typed in.

still with the flags, can the conversion result also have the flag of the country/union displayed in front of the result ? so that when a user carries out a conversion like "HRK to ARS" the result would be: ≈ Argentinian flag, ARS, result

finally, i still have to type in the currency code for countries instead of the country name or currency name is this in the works ?

hanna-kn commented 6 years ago

could the country flag be displayed in the entry box as well ? such that when "dollar to euro" is entered their flags will be displayed in the box in front of their names.

If you mean the main expression entry, then the answer is an unequivocal no.

it would also be great to have the flags appear in the suggestion popup when a currency/country is being typed in

The problem with this is that lists where only some items have an icon looks ugly and is a bit distracting.

still with the flags, can the conversion result also have the flag of the country/union displayed in front of the result ? so that when a user carries out a conversion like "HRK to ARS" the result would be: ≈ Argentinian flag, ARS, result

It might be difficult to make it look nice and intuitive, and I would argue that the benefit is small. I will try adding a small flag in the upper right corner and see how it looks.

finally, i still have to type in the currency code for countries instead of the country name or currency name is this in the works ?

There are some issues with implementing that in the expression entry (in addition to the search entries). It should be possible to add suggestions based on country and currency name. To avoid long lists dominated by currencies (which is that the reason that most currencies do not show up in the list unless you enter the full code) you will have to enter at least three or four characters of the name for it to show up.

hanna-kn commented 6 years ago

Improved suggestions and flags in result (when currency code is used) are now done.

screenshot 1 screenshot 2

hanna-kn commented 6 years ago

Flags in suggestions list done.

screenshot 3

majumeke commented 6 years ago

excellent work, the screenshots look really good. Thank you.

typing in a country name or currency name in addition to currency code is priceless. no more having to remember currency codes or having to type in uppercase to match the code. the flags also make for a consistent experience when dealing with currencies and can also be used as a small learning tool.

again much appreciated.

majumeke commented 6 years ago

in 2.6 the country/currency search is much better. i can now type the country name or currency name in any case and get a hit, Thank you.

i've noticed that you need to type in the first three letters of a country or a currency to get suggestions from the currency list, is this by design ? if i want to get a result for pounds, typing "br" or "po" will not return "British Pounds" in the suggestions but entering "bri" or "pou" will.

the country flags look really good, i have found an issue though with currencies that display symbols rather than their currency code like the Korean Won.

conversion of Icelandic krona to Algerian dinar

dinar

conversion of Icelandic krona to Korean won

won

the flag in the result is not displayed when there is a currency symbol($, €, £, etc)

hanna-kn commented 6 years ago

i've noticed that you need to type in the first three letters of a country or a currency to get suggestions from the currency list, is this by design ? if i want to get a result for pounds, typing "br" or "po" will not return "British Pounds" in the suggestions but entering "bri" or "pou" will.

This is by design, to avoid long suggestion lists dominated by currencies. The suggestions would sometimes with have over 100 items that might appear random. The main issue with this approach is that it makes the new feature difficult for users to discover. I'm considering making the completion suggestions configurable.

the flag in the result is not displayed when there is a currency symbol($, €, £, etc)

This was also a conscious decision. The flags seemed unnecessary and more distracting for common symbols (and spelled out names with abbreviations deactivated). Although for "exotic" currencies, the symbol might be more confusing than the three character code (a possible solution for these relatively few cases would be to give the code higher priority than the symbol).

majumeke commented 6 years ago

This is by design, to avoid long suggestion lists dominated by currencies. The suggestions would sometimes with have over 100 items that might appear random. The main issue with this approach is that it makes the new feature difficult for users to discover.

understood and yes this would be an unfortunate feature to go undiscovered

I'm considering making the completion suggestions configurable.

personally i believe the sweet spot to be at two letters typed, but the ideal scenario as you mentioned would be to have the suggestions configurable. hopefully your consideration for configurable suggestions becomes concrete.

This was also a conscious decision. The flags seemed unnecessary and more distracting for common symbols (and spelled out names with abbreviations deactivated). Although for "exotic" currencies, the symbol might be more confusing than the three character code (a possible solution for these relatively few cases would be to give the code higher priority than the symbol).

i have to very respectfully and humbly disagree with this decision. i feel that the flag display should be consistent across symbols and codes. dollars, pounds and euros are common and most people would know the flags of their respective countries/regions but, as you mentioned, we have symbols for currencies such as the Afghan afghani(؋), Armenian dram(֏), Lao kip(₭), Vietnamese dong(₫) that could be seen as being exotic. in my view, having a flag by the symbol would make the currency and its symbol appear less exotic to a casual user. this will ensure a consistent experience to a user used to getting a country flag to go with the currency code also seeing the same with currency symbols. another option, as with the proposed configurable suggestion list, would be to make this feature configurable. so that if a user likes to see a country flag along with the currency code/symbol they'll be able to enable this in the settings. a bonus feature would be the ability to configure the location of the flag in the results.

hanna-kn commented 6 years ago

To my eyes this looks bad: Screenshot 1

Before I enable flags for symbols I better placement is needed for the flag when the currency is put in front of the number without any space (and I'm not fond of the idea of placing the flag to the left either).

Generally, solving design issues by adding configuration options is a bad idea, so my priority is to improve the default setting.

hanna-kn commented 6 years ago

I've now implemented a variant where the flag is placed after the number if there is no space between the currency symbol and the number.

majumeke commented 6 years ago

it doesn't look all that bad to me, but the flag after the number should work too. at least, now, there's consistency in the displaying of these flags.

Much thanks.

majumeke commented 6 years ago

just installed version 2.6.1 and i have to give you my sincerest and abundant Thanks. this currency list improvement issue can now be closed as the currency list is now improved by leaps and bounds over my original suggestion. as a bonus the suggestion popup is now more configurable with the new "Completion" preference pane. i really appreciate your leniency and quick turnaround in implementing my suggestions in this issue, Thank you.

danieldjewell commented 4 years ago

Hi All,

Just noticed something that I found peculiar - I did my best poking around the source to see if I could find it but my knowledge of GTK APIs is seriously lacking ...

In the Units Editor for Currencies (this is v3.6.0 - the latest win64 build), there appear to be three columns - none have a heading and you can't open the "Edit" dialog to view the details that you normally would be able to.

The third column (see picture below) has either a "$" or "€" sign in it for every currency except EUR (even USD shows "€")

In other unit categories, the third column is the definition of the unit (or the base unit)... So does that mean that all currencies are being derived from the EUR? And then a bunch more are being derived twice (e.g. Saudi Riyal SAR <> USD <> EUR?)

image

Thanks!

hanna-kn commented 4 years ago

So does that mean that all currencies are being derived from the EUR? And then a bunch more are being derived twice (e.g. Saudi Riyal SAR <> USD <> EUR?).

This is correct. Euro is the currency base unit in Qalculate. The exchange rates in the data from the ECB are provided in relation to EUR, while the mycurrency.net data set uses USD. When converting between currencies from the same data set (as well as USD), additional conversion to EUR is not required. When converting between currencies with different base units an additional step is however necessary.

Conversion using exchange rates from both the ECB and mycurrency.net will unfortunately avoidably, because of different update frequencies, result in reduced precision (< 1%). I am considering if it might be beneficial to perform the conversion from USD to EUR directly when loading the data using the rate provided by mycurrency.net (and thus use EUR as the immediate base unit for all currencies).