[GNC] mac GnuCash "The locale defined in the environment isn't supported" error from command line

Jim DeLaHunt list+gnucash at jdlh.com
Wed Jul 10 15:05:35 EDT 2019


Hello, Gnucash users:

I am using Gnucash 3.6-1 on macOS 10.11.6 (El Capitan). I don't normally 
run Gnucash from the command line, but when I do, I see an error message 
about the locale:

% /Applications/Gnucash.app/Contents/MacOS/Gnucash --debug --extra
Application Path /Applications/Gnucash.app/Contents/MacOS/Gnucash

(process:97574): gnc.gui-WARNING **: 18:23:33.979: [mac_set_languages()] Language list: en:C:ja:de:zh_CN:zh_TW
The locale defined in the environment isn't supported. Falling back to the 'C' (US English) locale
%

Gnucash runs with English language in its GUI, as expected. However, I 
would not expect to see an error message about the locale not being 
supported.

I expect that "locale defined in the environment" is "en_CA". The 
Gnucash wiki says, in /Locale Settings/ # *Changing the Language on 
MacOS* 
<https://wiki.gnucash.org/wiki/Locale_Settings#Changing_the_Language_on_MacOS>, 
that the Gnucash selects from the language list set in the OS. When this 
message occurred, my System Preferences… Language & Region… Preferred 
Language is set to a list of 5 languages beginning with English as 
primary, and my region is set to Canadian. The locale settings appear to be:

% locale
LANG="en_CA.UTF-8"
LC_COLLATE="en_CA.UTF-8"
LC_CTYPE="en_CA.UTF-8"
LC_MESSAGES="en_CA.UTF-8"
LC_MONETARY="en_CA.UTF-8"
LC_NUMERIC="en_CA.UTF-8"
LC_TIME="en_CA.UTF-8"
LC_ALL=

Maybe the problem is with the Canadian region? (The "_CA" suffix.) No, 
changing the Mac region to United States doesn't change the error. After 
making the change in System Preferences, I ran the following in a new 
terminal window.

% locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=
% /Applications/Gnucash.app/Contents/MacOS/Gnucash --debug --extra
Application Path /Applications/Gnucash.app/Contents/MacOS/Gnucash

(process:97708): gnc.gui-WARNING **: 19:08:19.091: [mac_set_languages()] Language list: en:C:ja:de:zh_CN:zh_TW
The locale defined in the environment isn't supported. Falling back to the 'C' (US English) locale
%

In this configuration, the Gnucash GUI still appears, still in English.

I tried setting the language to German and the region to Germany in 
System Preferences. Then I invoked the Gnucash GUI from a new terminal 
window.

% locale
LANG="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_CTYPE="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_ALL=
% /Applications/Gnucash.app/Contents/MacOS/Gnucash
Application Path /Applications/Gnucash.app/Contents/MacOS/Gnucash

(process:98121): gnc.gui-WARNING **: 20:52:37.069: [mac_set_languages()] Language list: en:de:en:C:ja:zh_CN:zh_TW
The locale defined in the environment isn't supported. Falling back to the 'C' (US English) locale
%

The wiki section /Locale Settings/ # *Changing the Language on MacOS* 
talks about the Mac OS X user defaults system, as controlled by the 
defaults command in Terminal. The wiki section mentions using "-app 
Gnucash AppleLanguages" to control the translation which Gnucash 
chooses. I had no setting for this. When I set it to '(en, de)', that 
changed the Language list in the error message, but not the presence of 
the error message, nor the resulting app UI.  Similarly, the wiki 
section mentions using "-app Gnucash AppleLocale" to adjust the other 
locale settings. This had no effect for me. The UI came up in English, 
not German, regardless of the AppleLanguages being set or deleted.

% defaults write -app Gnucash AppleLanguages '(de, en)'
% defaults write -app Gnucash AppleLocale 'de_DE'
% /Applications/Gnucash.app/Contents/MacOS/Gnucash --debug --extra
Application Path /Applications/Gnucash.app/Contents/MacOS/Gnucash

(process:98475): gnc.gui-WARNING **: 21:57:42.797: [mac_set_languages()] Language list: de:en:C
The locale defined in the environment isn't supported. Falling back to the 'C' (US English) locale

% defaults delete -app Gnucash AppleLanguages
% defaults delete -app Gnucash AppleLocale
% /Applications/Gnucash.app/Contents/MacOS/Gnucash --debug --extra
Application Path /Applications/Gnucash.app/Contents/MacOS/Gnucash

(process:98486): gnc.gui-WARNING **: 22:01:11.732: [mac_set_languages()] Language list: en:C:de:ja:zh_CN:zh_TW
The locale defined in the environment isn't supported. Falling back to the 'C' (US English) locale
%

Is the error message correct that "the locale… isn't supported"? By 
this, does it mean the locale set by System Preferences, as claimed by 
the wiki, or does it really mean "defined in the environment" as an 
environment variable?  (In any case, it would sure be nice if the error 
message included the locale or setting it retrieved.)

Is there a change I can make to remove the error and stop the error 
message?  That's really the problem which prompted me to explore this 
whole area.

Is the wiki correct that Gnucash displays UI language according to 
System Preferences settings, or according to the user defaults system 
values for "-app Gnucash AppleLanguages" and "-app Gnucash AppleLocale"? 
This seemed to have no effect for me. What am I doing wrong? Or what 
about the wiki's explanation is wrong?

I read through the trace file. I didn't see anything related to this 
error message there. There were only two mentions of "locale", both in 
names of keys read by gnc.app-utils.gsettings.

Bug 725296 - Unable to change language from english using the 
environment file <https://bugs.gnucash.org/show_bug.cgi?id=725296> is 
the closest I've found to a relevant bug, and it seems to be about Linux 
and Windows locale selection, not macOS.

(By the way, it would be helpful if the error message displayed the 
locale value it thinks it retrieved, and if a similar error were written 
to the trace file.)

Thanks in advance for your clarifications,
      —Jim DeLaHunt, Vancouver, Canada

-- 
     --Jim DeLaHunt,jdlh at jdlh.com      http://blog.jdlh.com/  (http://jdlh.com/)
       multilingual websites consultant



More information about the gnucash-user mailing list