[GRASS-dev] locale problem solved - but have suggestion

Maris Nartiss maris.gis at gmail.com
Wed Aug 8 05:00:11 PDT 2012

Hello Michael,
patch now is obsolete as changes are already in trunk.

I added English to the list of languages, as it was missing because of
my error. We don't ship GRASS with English translations ;)

While writing this mail, I realized, that current approach works on my
system but might not work on other systems. I changed setting of
language to setting up all environmental variables to selected
language except LC_NUMERIC, to avoid problems with sloppy code that
might expect "." as a decimal separator. I know, such code should be
fixed in the first place, still it's might be not so easy to do.
Still using LC_ALL instead of just LC_MESSAGES is a bit worth of
discussion, I would like to hear arguments against it.
I also changed logic a bit - if system doesn't support locale, we set
LANG anyway in a hope, that at least GRASS UI part will be in user's
selected locale.
Tested and it works just fine on MS-Windows.
On Linux there's an error message "unable to set locale blahblah",
still UI seems to work just fine.
To remove this annoying error message when launching any wx window, is
necessary to add following line after every "import wx" line:
If there will be no other objections on current language switching
logic, it could be done by find/replace.

Michael, please, update trunk to r52597 and test again.

If language switching doesn't work for You for some strange reason,
here are checks to perform:
Launch GRASS and change language to YOURLANG. Save. Close GRASS.
In text editor, open file .grass7/rc The first line of file now should
Start GRASS and observe any error messages during startup ("Failed to
set LC_MESSAGES to YOURLANG..."). Be ware - if Your selected language
isn't supported on Your system by Python, it will print an error as a
first textual output of GRASS. In such case, GRASS fails back to
system default language - as if nothing had been set in GUI
In terminal window run "locale" command and check following variables:
In terminal window run "locale -a" command and check if it lists YOURLANG
In Python console run:
import locale
locale.setlocale(locale.LC_MESSAGES, 'YOURLANG')

Sorry for being a bit messy, still I started to write this mail at 8am
and now is 3pm and all the time I was playing around to figure out
best way how to make it in the best way...

2012/8/7 Michael Barton <Michael.Barton at asu.edu>:
> OK. I just compiled GRASS 7 with-nls and tried the new language patch.
> It makes no difference. Nothing changes when I switch from System to es.
> Everything stays in English. Given Glynn's post last week, I think that we
> need to try a different approach of GRASS changing the system language
> setting for the given session. Then have Python read that system setting.
> This is an important feature to have in GRASS, given its wide international
> use. But we need it to work on all systems.
> BTW, I did not see English in the list of languages to select. Odd.
> Michael
> ______________________________
> C. Michael Barton
> Director, Center for Social Dynamics & Complexity
> Professor of Anthropology, School of Human Evolution & Social Change
> Arizona State University
> Tempe, AZ  85287-2402
> voice:  480-965-6262 (SHESC), 480-727-9746 (CSDC)
> fax:          480-965-7671(SHESC), 480-727-0709 (CSDC)
> www:  http://csdc.asu.edu, http://shesc.asu.edu
> http://www.public.asu.edu/~cmbarton

More information about the grass-dev mailing list