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

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
USA

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

On Aug 7, 2012, at 12:00 PM, <grass-dev-request@lists.osgeo.org>
wrote:

From: Markus Neteler <neteler@osgeo.org>

Date: August 7, 2012 8:55:16 AM MST

To: Maris Nartiss <maris.gis@gmail.com>

Cc: grass-developers <grass-dev@lists.osgeo.org>

Subject: Re: [GRASS-dev] locale problem solved - but have suggestion

On Tue, Aug 7, 2012 at 5:25 PM, Maris Nartiss <maris.gis@gmail.com> wrote:

Sorry!

At one point I was thinking about adding necessary code, still I

forgot about it. Fixed in r52582.

Thanks, works again.

Markus

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

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:
wx.LogGui.EnableLogging(False)
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
be LANG: YOURLANG
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
preferences.
In terminal window run "locale" command and check following variables:
LANG, LC_MESSAGES
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...
Maris.

2012/8/7 Michael Barton <Michael.Barton@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
USA

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

Thanks Masris,

I will try again today.

Michael

On Aug 8, 2012, at 5:00 AM, Maris Nartiss wrote:

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

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:
wx.LogGui.EnableLogging(False)
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
be LANG: YOURLANG
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
preferences.
In terminal window run "locale" command and check following variables:
LANG, LC_MESSAGES
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...
Maris.

2012/8/7 Michael Barton <Michael.Barton@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
USA

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

_____________________
C. Michael Barton
Visiting Scientist, Integrated Science Program
National Center for Atmospheric Research &
University Consortium for Atmospheric Research
303-497-2889 (voice)

Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

YES!!!

This works. Thanks very much. It needs to be backported now. It also makes it much easier to see where we need to update language support.

Now to get LAS support working and release new Mac binaries.

Cheers
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
USA

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

On Aug 8, 2012, at 5:00 AM, Maris Nartiss wrote:

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

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:
wx.LogGui.EnableLogging(False)
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
be LANG: YOURLANG
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
preferences.
In terminal window run "locale" command and check following variables:
LANG, LC_MESSAGES
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...
Maris.

2012/8/7 Michael Barton <Michael.Barton@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
USA

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