2002-11-30 Christian Stimming <stimming@tuhh.de>

* src/app-utils/gnc-ui-util.[hc]: Added
	gnc_locale_default_currency_nodefault function since
	locale_default_currency might return a non-locale related
	currency. Fix xaccSPrintAmount. Fixes #95404.

	* src/engine/iso-4217-currencies.scm ("rouble"): Fix mnemonic for
	Russian Rouble which is "RUR" instead of RUB.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7574 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming
2002-11-30 13:38:34 +00:00
parent 30fe18b651
commit a0e5b8f830
4 changed files with 32 additions and 7 deletions

View File

@@ -1,5 +1,13 @@
2002-11-30 Christian Stimming <stimming@tuhh.de>
* src/app-utils/gnc-ui-util.[hc]: Added
gnc_locale_default_currency_nodefault function since
locale_default_currency might return a non-locale related
currency. Fix xaccSPrintAmount. Fixes #95404.
* src/engine/iso-4217-currencies.scm ("rouble"): Fix mnemonic for
Russian Rouble which is "RUR" instead of RUB.
* src/business/business-gnome/business-gnome.scm,
src/gnome-utils/gnc-mdi-utils.c,
src/gnome-utils/gnc-menu-extensions.c,

View File

@@ -1060,7 +1060,7 @@ gnc_locale_default_iso_currency_code (void)
}
gnc_commodity *
gnc_locale_default_currency (void)
gnc_locale_default_currency_nodefault (void)
{
gnc_commodity * currency;
gnc_commodity_table *table;
@@ -1071,10 +1071,17 @@ gnc_locale_default_currency (void)
currency = gnc_commodity_table_lookup (table, GNC_COMMODITY_NS_ISO, code);
if (currency)
return currency;
return (currency ? currency : NULL);
}
return gnc_commodity_table_lookup (table, GNC_COMMODITY_NS_ISO, "USD");
gnc_commodity *
gnc_locale_default_currency (void)
{
gnc_commodity * currency = gnc_locale_default_currency_nodefault ();
return (currency ? currency :
gnc_commodity_table_lookup (gnc_get_current_commodities (),
GNC_COMMODITY_NS_ISO, "USD"));
}
@@ -1547,8 +1554,12 @@ xaccSPrintAmount (char * bufp, gnc_numeric val, GNCPrintAmountInfo info)
if (info.use_symbol)
{
if (gnc_commodity_equiv (info.commodity, gnc_locale_default_currency ()))
/* There was a bug here: don't use gnc_locale_default_currency */
if (gnc_commodity_equiv (info.commodity,
gnc_locale_default_currency_nodefault ()))
{
currency_symbol = lc->currency_symbol;
}
else
{
if (info.commodity &&

View File

@@ -142,7 +142,13 @@ PriceSourceCode gnc_get_source_code (const char * codename);
* is given default (en_US) values. */
struct lconv * gnc_localeconv (void);
/* Returns the default currency of the current locale. */
/* Returns the default currency of the current locale, or NULL if no
* sensible currency could be identified from the locale. */
gnc_commodity * gnc_locale_default_currency_nodefault (void);
/* Returns the default currency of the current locale. WATCH OUT: If
* no currency could be identified from the locale, this one returns
* "USD", but this will have nothing to do with the actual locale. */
gnc_commodity * gnc_locale_default_currency (void);
/* Returns the default ISO currency string of the current locale. */

View File

@@ -144,7 +144,7 @@
( "Portuguese Escudo" "escudo" "centavo" "ISO4217" "PTE" "620" 100 100 ) ;; through 1998
( "Qatari Rial" "rial" "dirham" "ISO4217" "QAR" "634" 100 100 )
( "Romanian Leu" "leu" "bani" "ISO4217" "ROL" "642" 100 100 )
( "Russian Rouble" "rouble" "kopek" "ISO4217" "RUB" "810" 100 100 )
( "Russian Rouble" "rouble" "kopek" "ISO4217" "RUR" "810" 100 100 )
( "Rwanda Franc" "franc" "centime" "ISO4217" "RWF" "646" 100 100 )
( "Samoan Tala" "tala" "sene" "ISO4217" "WST" "882" 100 100 )
( "Sao Tome and Principe Dobra" "Dobra" "centimo" "ISO4217" "STD" "678" 100 100 )