[GNC] Decimal separator on Gnucash 3.2 Mac (fixed !!!)

Yves Forget yves_forget at yahoo.ca
Sat Aug 4 23:26:07 EDT 2018


Problem fixed.  I thought I’d share with the list in case the problem happens to someone else.

I installed GnuCash short after upgrading from OSX 10.9 to 10.13.  Gnucash uses period as decimal separator, while here in French Canada decimal separator should be comma.

After asking the list I saw that Quicken 2015 for Mac did the same.  Annoying that my numeric keypad would send comma but GnuCash and Quicken both want a period.

I’m sure Quicken worked fine on 10.9 (displaying and expecting comma), because in old printed reports I got the comma as decimal separator.

Today I noticed that in System Preferences/Language and region, my preferred regions were French Canada and English Canada, with French Canada as main region.  If I remove English Canada (keeping only French Canada), both Gnucash and Quicken want a comma.  Bring back English Canada (with French Canada as main region), both want a period.

Seems to be a bug on Apple’s side, where locale is set to EN_CA even if main region is French Canada.

So I kept only French Canada in region preferences and everything works fine.

Thanks,

Yves Forget


> Le 3 juill. 2018 à 12:33, John Ralls <jralls at ceridwen.us> a écrit :
> 
> Yves,
> 
> And just for completeness I added a line to read NSLocaleDecimalSeparator and then examined it in the debugger. It's '.', consistent with the locale being en_CA instead of fr_CA. 
> 
> Regards,
> John Ralls
> 
> 
>> On Jul 2, 2018, at 7:57 PM, John Ralls <jralls at ceridwen.us> wrote:
>> 
>> Yves,
>> 
>> No, unfortunately querying NSLocaleDecimalSeparator and friends  won’t help. GnuCash depends at least partly on libc functions like printf (and their C++ equivalents) for formatting, and those functions in turn depend on a locale being set in the environment. They use that locale to retrieve information like decimal separator from the files in /usr/share/locale. In the case at hand, LC_MONETARY. The fact that NSLocaleLanguageCode returns en_CA instead of fr_CA causes the wrong LC_MONETARY to be consulted.
>> 
>> Given that GnuCash needs to work on Windows and other Unixes besides MacOS, the only alternative that I know of is ICU. WebKit uses it so it’s already a dependency but it would be a lot of work to convert; the API would need to be made available to Scheme as well for the reports because Guile also uses libc localization. It’s likely a multi-year project for a single programmer. (Well, multi-month at 40 hours/week.) Wanna volunteer?
>> 
>> Regards,
>> John Ralls
>> 
>> 
>> 
>>> On Jul 2, 2018, at 7:36 PM, Yves Forget <yves_forget at yahoo.ca> wrote:
>>> 
>>> Hi John,
>>> 
>>> Running from the terminal I still get period.  In the terminal I got the following trace.
>>> 
>>> (process:1976): gnc.gui-WARNING **: 18:35:55.003: [mac_set_languages()] Language list: en:fr_CA:en_CA:C
>>> 
>>> I just downloaded the sources from GitHub, and looked at [mac_set_languages()].  Foundation offers global variables NsLocaleDecimalSeparator, NSLocaleGroupingSeparator and NSLocaleCurrencySymbol, among others.  These variables would bring directly the values mac_set_languages() is trying to get.  Furthermore, if a user changes the decimal separator in the Advanced panel of the Language and Region system preferences, gnu cash would get the expected separator instead of the locale’s default separator.  Is it something that could be changed without breaking a lot of things in the app ?
>>> 
>>> Please don’t hesitate to tell me if I’m completely wrong…
>>> 
>>> Thanks,
>>> 
>>> Yves
>>> 
>>>> Le 2 juill. 2018 à 18:43, John Ralls <jralls at ceridwen.us <mailto:jralls at ceridwen.us>> a écrit :
>>>> 
>>>> I tested this a bit in the debugger and I with French as the primary language and Canada as the country [currentlocale objectForKey:  NSLocaleLanguageCode] insists that the code in en, not French. If I tell System Prefs I'm in France it gets the right answer, so it might be an Apple bug.
>>>> 
>>>> Unfortunately setting LANG in the environment, though it will set the interface language, doesn't seem to change the number display, so there doesn't seem to be a way to force it at present.
>>>> 
>>>> Regards,
>>>> John Ralls
>>>> 
>>>> 
>>>>> On Jul 2, 2018, at 2:59 PM, John Ralls <jralls at ceridwen.us <mailto:jralls at ceridwen.us>> wrote:
>>>>> 
>>>>> If you run GnuCash from a Terminal prompt do you get the right separator?
>>>>> 
>>>>> Regards,
>>>>> John Ralls
>>>>> 
>>>>>> On Jul 2, 2018, at 1:42 PM, Yves Forget via gnucash-user <gnucash-user at gnucash.org <mailto:gnucash-user at gnucash.org>> wrote:
>>>>>> 
>>>>>> System Preferences/Language and Region says Region = Canada and language = french.  Advanced shows decimal separator is comma and thousands separator is space.  (These are default values for French Canada).
>>>>>> Environment variable LANG=fr_CA.UTF_8
>>>>>> OpenOffice correctly uses comma as decimal separator.
>>>>>> Is Gnucash supposed to use the parameters from the locale ?  Is there a way to force it ?
>>>>>> Thanks,
>>>>>> Yves Forget
>>>>>> 
>>>>>> Le lundi 2 juillet 2018 15h48, R. Victor Klassen <rvklassen at gmail.com <mailto:rvklassen at gmail.com>> a écrit :
>>>>>> 
>>>>>> 
>>>>>> Maybe in Quebec it is a comma.  In the rest of the country it is a period.  
>>>>>> 
>>>>>> There should be a different locale for fr-canada than for en-canada.  I don’t know what else would differ across locales though.
>>>>>> 
>>>>>>> On Jul 2, 2018, at 3:42 PM, Yves Forget via gnucash-user <gnucash-user at gnucash.org <mailto:gnucash-user at gnucash.org>> wrote:
>>>>>>> 
>>>>>>> I’m new to GnuCash and just installed GnuCash 3.2 on Mac. OS X 10.13
>>>>>>> Gnucash uses the period as decimal separator instead of my locale’s
>>>>>>> separator.  Here in Canada it should be comma.
>>>>>>> Should Gnucash use the decimal separator of my locale, or is it always
>>>>>>> period ?  Is there a way to configure it within GnuCash ?
>>>>>>> Thanks,
>>>>>>> Yves Forget
>>>>>>> _______________________________________________
>>>>>>> gnucash-user mailing list
>>>>>>> gnucash-user at gnucash.org <mailto:gnucash-user at gnucash.org>
>>>>>>> To update your subscription preferences or to unsubscribe:
>>>>>>> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>>>>>>> If you are using Nabble or Gmane, please see https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
>>>>>>> -----
>>>>>>> Please remember to CC this list on all your replies.
>>>>>>> You can do this by using Reply-To-List or Reply-All.
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> _______________________________________________
>>>>>> gnucash-user mailing list
>>>>>> gnucash-user at gnucash.org <mailto:gnucash-user at gnucash.org>
>>>>>> To update your subscription preferences or to unsubscribe:
>>>>>> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>>>>>> If you are using Nabble or Gmane, please see https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
>>>>>> -----
>>>>>> Please remember to CC this list on all your replies.
>>>>>> You can do this by using Reply-To-List or Reply-All.
>>>>> 
>>>>> _______________________________________________
>>>>> gnucash-user mailing list
>>>>> gnucash-user at gnucash.org <mailto:gnucash-user at gnucash.org>
>>>>> To update your subscription preferences or to unsubscribe:
>>>>> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>>>>> If you are using Nabble or Gmane, please see https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
>>>>> -----
>>>>> Please remember to CC this list on all your replies.
>>>>> You can do this by using Reply-To-List or Reply-All.
>>>> 
>>> 
>> 
>> _______________________________________________
>> gnucash-user mailing list
>> gnucash-user at gnucash.org
>> To update your subscription preferences or to unsubscribe:
>> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>> If you are using Nabble or Gmane, please see https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
>> -----
>> Please remember to CC this list on all your replies.
>> You can do this by using Reply-To-List or Reply-All.
> 



More information about the gnucash-user mailing list