Reports are always in USD

Derek Atkins warlord@MIT.EDU
23 Jul 2002 18:06:50 -0400


Christian Krause <chkr@plauener.de> writes:

> In gnc_localeconv you call localeconv() but where is the locale
> initialized via setlocale? gnc_push/pop_locale isn't called anywhere (I
> inserted some debugs to verify this)

setlocale is called from a number of places (both C and Scheme):

./src/app-utils/gnc-ui-util.c:  saved_locale = g_strdup (setlocale (LC_ALL, NULL));
./src/app-utils/gnc-ui-util.c:  setlocale (LC_ALL, locale);
./src/app-utils/gnc-ui-util.c:  setlocale (LC_ALL, saved_locale);
./src/gnome/druid-hierarchy.c:    locale = g_strdup(setlocale(LC_MESSAGES, NULL));
./src/gnome/druid-hierarchy.c:     * setlocale can sometimes return NULL instead of "C"
./src/gnome/druid-hierarchy.c:    locale = g_strdup(setlocale(LC_ALL, NULL) ? 
./src/gnome/druid-hierarchy.c:                setlocale(LC_ALL, NULL) : "C");

./src/scm/main.scm:    (let* ((locale (or (false-if-exception (setlocale LC_MESSAGES))
./src/scm/main.scm:                    (setlocale LC_ALL)))
./src/scm/main.scm:    (setlocale LC_ALL "")

> How should this work? What is the purpose of these functions?

I have no idea.  I didn't write them.  I'm just following backwards
from gnc:options-set-currency! procedure that is called in many
reports.  This procedure is defined in the reports section
src/reports/report-utilities/options-utilities.scm and calls the
"locale-default currency" to be the default.

> I think the currency of the reports should be the configured default
> currency of gnucash and should not depend on my locale settings.

"configured default currency of gnucash"?  There is a problem here,
because you could have multiple books that use different default
currencies.  Perhaps the default currency should be stored in the book
instead of some global option?

> But first of all: Can you or anybody other reproduce this bug?
> > How to reproduce:
> > - New File
> > - in the wizard: select "EUR", "Common Accounts"
> > - put some money in the wallet
> > - make a transaction: e.g. buy a book ;-)
> > - try the reports

I have not tried it, but I believe you..  I can see exactly why it's
behaving the way it is.  If you set your locale I bet the problem
(somewhat) goes away.

Did you try setting your locale to something that would put you into
Euroland?

> regards,
> christian

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord@MIT.EDU                        PGP key available