Problems trying to get currency separator correct for CAD

John Ralls jralls at ceridwen.us
Fri Jul 22 11:53:25 EDT 2011


On Jul 22, 2011, at 11:29 AM, bunk3m wrote:

> On 22.07.2011 11:17, John Ralls wrote:
>> On Jul 22, 2011, at 9:52 AM, bunk3m wrote:
>> 
>>> On 22.07.2011 09:21, John Ralls wrote:
>>>> On Jul 22, 2011, at 9:00 AM, John Ralls wrote:
>>>> 
>>>>> On Jul 21, 2011, at 5:58 PM, bunk3m wrote:
>>>>> 
>>>>>> Thank you, John.
>>>>>> 
>>>>>> In the earlier part of my post which I guess got lost, I mentioned that
>>>>>> I had already tried to do this using the wiki post.
>>>>>> 
>>>>>> In the FAQ it says to do the following command to customize: "defaults
>>>>>> write -app Gnucash AppleLocale = "en_US at currency=CAD" "
>>>>>> 
>>>>>> This command should actually be:
>>>>>> 
>>>>>> defaults write -app /Applications/Gnucash/Gnucash.app
>>>>>> AppleLocale="en_US at currency=CAD"
>>>>>> 
>>>>>> But I get an error:
>>>>>> 2011-07-20 13:42:44.553 defaults[4877:10b]
>>>>>> Rep argument is not a dictionary
>>>>>> Defaults have not been changed.
>>>>>> 
>>>>>> Can you help me with understanding why the command didn't work?
>>>>> Apparently not; it isn't working for me on my MBA, either. 
>>>>> 
>>>>> The syntax *is* correct in the FAQ article. See "Specifying Domains" in the defaults manpage. I'll have to figure out why it doesn't work for Gnucash.
>>>> Well,,, the syntax was *almost* correct in the Wiki article (it's fixed now, with a note).
>>>> The command is:
>>>> 
>>>> defaults write -app Gnucash AppleLocale 'en_US at currency=CAD'
>>>> 
>>>> Note the single quotes. It's the double quotes that were causing the error.
>>>> 
>>>> Regards,
>>>> John Ralls
>>> Thank you for helping out with the command, John.
>>> 
>>> Gnucash preferences:account has always shown the Default Currency to be
>>> Locale: CAD (Canadian Dollar).  This has always been selected.
>>> 
>>> When I typed the command you posted above I got:
>>>  $ defaults write -app Gnucash AppleLocale 'en_US at currency=CAD'
>>> 
>>>  $ 2011-07-22 09:37:03.093 defaults[2413:10b] Couldn't find an
>>> application named "Gnucash"; defaults unchanged
>>> 
>>> So I changed it to:
>>> 
>>>  $ defaults write -app /Applications/Gnucash/Gnucash.app AppleLocale
>>> 'en_US at currency=CAD'
>>> 
>>> This appears to have worked since there was no error message.  However,
>>> I still have a comma for the currency separator between the dollars and
>>> cents. ie. 1 234,56 $
>>> 
>>> :-(
>>> 
>>> There appears to be a bigger problem at play here. 
>>> 
>>> I took one of the other suggestions and changed the Default currency to
>>> USD.  Then I changed the currency of the cheque account to USD also.  I
>>> was hoping to get $1,234.56 as USD has the same currency separator as
>>> Canada.  Now I'm getting:
>>> 
>>>  USD 1 234,56
>>> 
>>> Ha ha ha.  This is nuts!   Grrrrr!!!
>>> 
>>> I restarted Gnucash just to see if that would make a difference.  But no
>>> joy.
>>> 
>>> So I change it back to CAD.  
>>> 
>>> Do you have any other suggestion?
>> Cool!
>> 
>> If you give a path to the application, leave off the -app flag:
>> 
>> defaults write /Applications/Gnucash/Gnucash.app AppleLocale 'en_US at currency=CAD'
>> 
>> back-test it with 
>> 
>> defaults read -app Gnucash AppleLocale
>> defaults read org.gnucash.Gnucash AppleLocale
>> defaults read /Applications/Gnucash/Gnucash.app AppleLocale
>> 
>> They should all report the same thing unless defaults is utterly confused by having the app in an unconventional location (it sure shouldn't be).
>> 
>> After futzing about with the account currencies to get two of them to work, I have CAD as the default currency from the locale and amounts in USD show as USD 1,234.56 while amounts in CAD show as $1,234.56.
>> 
>> What shows as the locale default currency in Gnucash? If it's CAD, then that part is working. Numeric formatting is actually independent of currency, and as you know, en_CA and en_US should produce the same results -- so just setting en_CA should do what you want. 
>> 
>> What is the result of 
>> defaults read -g AppleLocale ?
>> 
>> Regards,
>> John Ralls
> Hi John.
> 
> Here is the result:
> 
> a)    defaults read -app Gnucash AppleLocale
>  gives:
>       defaults[4580:10b] Couldn't find an application named "Gnucash";
> defaults unchanged
> 
> b)    defaults read org.gnucash.Gnucash AppleLocale
>  gives:
>       en_US at currency=CAD
> 
> c)    defaults read /Applications/Gnucash/Gnucash.app AppleLocale
>   gives:
>      defaults[4598:10b]
> The domain/default pair of (/Applications/Gnucash/Gnucash.app,
> AppleLocale) does not exist
> 
> The Locale currency in Gnucash is: CAD (Canadian Dollars)
> 
> Finally,
> 
>    defaults read -g AppleLocale
>  gives:
>    en_US at currency=CAD
> 
> But I still have: 1 234,56 $ 
> 
> (oh good grief...)
> 
> Thanks again for your help.  Any other things to try or check?
> B


Oops, GCE on the third read command: The file argument is for a prefs plist, not an app, so you were right to use -app:
  defaults read -app /Applications/Gnucash/Gnucash.app
or
  defaults read ~/Library/preferences/org.gnucash.Gnucash.plist
 
Anyway, it appears that you don't really need a special locale for gnucash, so let's start by getting that out of the way (quit Gnucash first):
  defaults delete org.gnucash.Gnucash

Now go to System Preferences>Languages and Text>Formats and select "Canada".

It occurs to me that something somewhere might be calling setlocale(LC_ALL, ""), which will read the environment and mess things up. Make sure that you don't have any of the LC_FOO or LANG environment variables overridden in Gnucash.app/Contents/MacOS/Gnucash and that you don't have a ~/.MacOSX/environment.plist.

Regards,
John Ralls







More information about the gnucash-user mailing list