Reports are always in USD

Christian Krause chkr@plauener.de
24 Jul 2002 23:37:54 +0200


On 23 Jul 2002 18:06:50 -0400, Derek Atkins wrote:

> 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):

The following is never called:
> ./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);


>> 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.

Ok, I found the changes in CVS. This explains why gnucash-1.6.6 works.

gnucash$ cvs diff -r 1.1 -r 1.2  src/report/report-system/options-utilities.scm 
Index: src/report/report-system/options-utilities.scm
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/report/report-system/options-utilities.scm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- src/report/report-system/options-utilities.scm      17 Aug 2001 00:43:31 -0000      1.1
+++ src/report/report-system/options-utilities.scm      3 Oct 2001 10:07:43 -0000       1.2
@@ -197,7 +197,7 @@
     pagename name-report-currency
     sort-tag 
     (N_ "Select the currency to display the values of this report in.")
-    (gnc:default-currency))))
+    (gnc:locale-default-iso-currency-code))))
 
 ;; These are common options for the selection of the report's
 ;; currency/commodity.


>> 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?

IMHO this would be the best solution... 

> 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.

Sorry, if I set LC_ALL=de_DE@euro nothing changes.

Only if I add setlocale in src/app-utils/gnc-ui-utils.c:

---------------------------------

gnucash/src/app-utils$ cvs diff gnc-ui-util.c 
Index: gnc-ui-util.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/app-utils/gnc-ui-util.c,v
retrieving revision 1.28
diff -u -r1.28 gnc-ui-util.c
--- gnc-ui-util.c       3 Jul 2002 05:59:51 -0000       1.28
+++ gnc-ui-util.c       24 Jul 2002 21:25:33 -0000
@@ -1016,9 +1016,9 @@
 
   if (lc_set)
     return &lc;
-
+  setlocale(LC_ALL, "");
   lc = *localeconv();
-
+  printf("debug: %s %s\n", lc.int_curr_symbol, lc.currency_symbol);
   gnc_lconv_set(&lc.decimal_point, ".");
   gnc_lconv_set(&lc.thousands_sep, ",");
   gnc_lconv_set(&lc.grouping, "\003");

---------------------------------

the reports are in EUR.

(But not the font! In the account window the EUR sign is correctly
displayed (as in the font latin-15), but in the report the currency sign
of latin-1 is displayed)

regards,
christian