[GRASS-dev] Messing with locale during start-up in r53620

Hello Martin,
can You, please, explain me rationale behind r53620?
Now GRASS mangles with LANG and LOCALE settings also when it shouldn't
- when no language overrider is in force. IMHO GRASS shouldn't
interfere with existing system settings unless explicitly requested by
user.

Related bug report: #1776

Thanks, Maris.

Hi,

2012/11/12 Maris Nartiss <maris.gis@gmail.com>:

can You, please, explain me rationale behind r53620?
Now GRASS mangles with LANG and LOCALE settings also when it shouldn't
- when no language overrider is in force. IMHO GRASS shouldn't
interfere with existing system settings unless explicitly requested by
user.

not fully understanding your report, wxGUI stores environmental
variables in .grass7/bashrc.

1)

env | grep LANG
LANG=en_US.UTF-8
LANGUAGE=en_US:en

start GRASS -> starts using system language settings

2)

LANG=cs_CZ grass70 -gui

-> starts in user defined settings

3)

* start wxGUI -> Settings -> Preferences -> Appearance -> change
language settings -> Save
* restart GRASS

-> starts with locales defined in .grass7/bashrc

$ cat /home/landa/.grass7/bashrc
export LANG=cs

grass70

env | grep LANG
LANG=cs
LANGUAGE=cs

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Hello,
OK, I missed the bashrc change, still it seems that GRASS is
interfering with locale where it shouldn't:
Set language to "system" == no entry in rc or bashrc
LANG=garbage bin.x86_64-unknown-linux-gnu/grass70

Satīra pagaidu failus...
Startē GRASS GIS...
Failed to set LC_ALL to garbage.UTF-8 (unsupported locale setting)

^^^ WTF?!? I didn't asked GRASS to touch anything locale related!

Also for some reason it isn't using the user provided language for
startup messages. Here's an example:
bin.x86_64-unknown-linux-gnu/grass70
Satīra pagaidu failus...
Startē GRASS GIS...
Failed to set LC_ALL to de_DE.UTF-8 (unsupported locale setting) <---
this is correct message, as I don't have de_DE

GUI comes up in de, still "Satīra pagaidu failus" isn't de nor
C/POSIX. I translated that string as "TEXT IN GERMAN", still it comes
up in system LANG.

I hope it clears a bit,
Maris.

2012/11/12 Martin Landa <landa.martin@gmail.com>:

Hi,

2012/11/12 Maris Nartiss <maris.gis@gmail.com>:

can You, please, explain me rationale behind r53620?
Now GRASS mangles with LANG and LOCALE settings also when it shouldn't
- when no language overrider is in force. IMHO GRASS shouldn't
interfere with existing system settings unless explicitly requested by
user.

not fully understanding your report, wxGUI stores environmental
variables in .grass7/bashrc.

1)

env | grep LANG
LANG=en_US.UTF-8
LANGUAGE=en_US:en

start GRASS -> starts using system language settings

2)

LANG=cs_CZ grass70 -gui

-> starts in user defined settings

3)

* start wxGUI -> Settings -> Preferences -> Appearance -> change
language settings -> Save
* restart GRASS

-> starts with locales defined in .grass7/bashrc

$ cat /home/landa/.grass7/bashrc
export LANG=cs

grass70

env | grep LANG
LANG=cs
LANGUAGE=cs

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

On Mon, November 12, 2012 18:41, Maris Nartiss wrote:

Hello,
OK, I missed the bashrc change, still it seems that GRASS is
interfering with locale where it shouldn't:

I get a similar issue in releasebranch64 (I tried to post this as a
ticket, but trac just keeps loging me out each time I try to submit...):

grass64_releasebranch, r53787, fresh checkout and compile

My locale settings:

{{{
$ locale
LANG=fr_BE.UTF-8
LANGUAGE=
LC_CTYPE="fr_BE.UTF-8"
LC_NUMERIC="fr_BE.UTF-8"
LC_TIME="fr_BE.UTF-8"
LC_COLLATE="fr_BE.UTF-8"
LC_MONETARY="fr_BE.UTF-8"
LC_MESSAGES="fr_BE.UTF-8"
LC_PAPER="fr_BE.UTF-8"
LC_NAME="fr_BE.UTF-8"
LC_ADDRESS="fr_BE.UTF-8"
LC_TELEPHONE="fr_BE.UTF-8"
LC_MEASUREMENT="fr_BE.UTF-8"
LC_IDENTIFICATION="fr_BE.UTF-8"
LC_ALL=
}}}

First launch of GRASS (i.e. no .grassrc6 file present), I get the GUI in
French and the following locale settings in the GRASS terminal:

{{{
~ > locale
LANG=fr_BE.UTF-8
LANGUAGE=fr_BE.UTF-8
LC_CTYPE="fr_BE.UTF-8"
LC_NUMERIC="fr_BE.UTF-8"
LC_TIME="fr_BE.UTF-8"
LC_COLLATE="fr_BE.UTF-8"
LC_MONETARY="fr_BE.UTF-8"
LC_MESSAGES="fr_BE.UTF-8"
LC_PAPER="fr_BE.UTF-8"
LC_NAME="fr_BE.UTF-8"
LC_ADDRESS="fr_BE.UTF-8"
LC_TELEPHONE="fr_BE.UTF-8"
LC_MEASUREMENT="fr_BE.UTF-8"
LC_IDENTIFICATION="fr_BE.UTF-8"
LC_ALL=
}}}

When I exit GRASS and relaunch it, I get the GUI in English and the
following locale settings in the GRASS terminal:

{{{
~ > locale
LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
}}}

When I exit GRASS again, erase .grassrc6 and then relaunch grass, I'm back
to the French GUI and fr_BE.UTF-8 locale. But next relaunch back to
English and Posix.

Moritz

Hi,

2012/11/12 Maris Nartiss <maris.gis@gmail.com>:

Hello,
OK, I missed the bashrc change, still it seems that GRASS is
interfering with locale where it shouldn't:
Set language to "system" == no entry in rc or bashrc
LANG=garbage bin.x86_64-unknown-linux-gnu/grass70

Satīra pagaidu failus...
Startē GRASS GIS...
Failed to set LC_ALL to garbage.UTF-8 (unsupported locale setting)

^^^ WTF?!? I didn't asked GRASS to touch anything locale related!

you asked to use 'garbage' locales which failed. I would expect it. In
this case system settings should be used.

Also for some reason it isn't using the user provided language for
startup messages. Here's an example:
bin.x86_64-unknown-linux-gnu/grass70
Satīra pagaidu failus...
Startē GRASS GIS...
Failed to set LC_ALL to de_DE.UTF-8 (unsupported locale setting) <---
this is correct message, as I don't have de_DE

GUI comes up in de, still "Satīra pagaidu failus" isn't de nor
C/POSIX. I translated that string as "TEXT IN GERMAN", still it comes
up in system LANG.

I would assume that your default locale is different from C/POSIX.

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Hi,

2012/11/13 Moritz Lennert <mlennert@club.worldonline.be>:

When I exit GRASS and relaunch it, I get the GUI in English and the
following locale settings in the GRASS terminal:

please try out r53791. Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Hi,
all fuss is about MY personal opinion that GRASS SHOULD NOT mess with
system provided locale and language settings UNLESS requested. I
re-run commands from previous mail with r52597 and here is result:
LANG=garbage bin.x86_64-unknown-linux-gnu/grass70
Satīra pagaidu failus...
Startē GRASS GIS...
(and GRASS starts just fine without any error messages as it is not
playing tricks with LANG at all)

After changing language to de (unsupported locale on my system):
bin.x86_64-unknown-linux-gnu/grass70
Failed to set LC_ALL to de_DE.UTF-8
THIS TEXT IS IN GERMAN
Starting GRASS GIS...

(process:11622): Gdk-WARNING **: locale not supported by C library

(process:11622): Gtk-WARNING **: Locale not supported by C library.
        Using the fallback 'C' locale.

There are some harmless error messages that can be easily fixed, still
GRASS IS using user specified language form the first user visible
message (THIS TEXT IS IN GERMAN message comes from grasslibs_de.po
file).

I agree that init part black magic could be enhanced. Especially
there's a question should CLI also be in user provided language? It's
a tricky subject, as i.e. cal utility with plain LANG is not enough.
Still now I start to think that GRASS shouldn't set anything else
except LANG, LANGUAGE and LC_MESSAGES.

Unless somebody can provide me strong arguments why GRASS should mess
with locale when not requested to do, I'll change startup part to set
only LANG and only when requested.

Maris.

2012/11/13 Martin Landa <landa.martin@gmail.com>:

Hi,

2012/11/12 Maris Nartiss <maris.gis@gmail.com>:

Hello,
OK, I missed the bashrc change, still it seems that GRASS is
interfering with locale where it shouldn't:
Set language to "system" == no entry in rc or bashrc
LANG=garbage bin.x86_64-unknown-linux-gnu/grass70

Satīra pagaidu failus...
Startē GRASS GIS...
Failed to set LC_ALL to garbage.UTF-8 (unsupported locale setting)

^^^ WTF?!? I didn't asked GRASS to touch anything locale related!

you asked to use 'garbage' locales which failed. I would expect it. In
this case system settings should be used.

Also for some reason it isn't using the user provided language for
startup messages. Here's an example:
bin.x86_64-unknown-linux-gnu/grass70
Satīra pagaidu failus...
Startē GRASS GIS...
Failed to set LC_ALL to de_DE.UTF-8 (unsupported locale setting) <---
this is correct message, as I don't have de_DE

GUI comes up in de, still "Satīra pagaidu failus" isn't de nor
C/POSIX. I translated that string as "TEXT IN GERMAN", still it comes
up in system LANG.

I would assume that your default locale is different from C/POSIX.

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

On 13/11/12 18:39, Martin Landa wrote:

Hi,

2012/11/13 Moritz Lennert<mlennert@club.worldonline.be>:

When I exit GRASS and relaunch it, I get the GUI in English and the
following locale settings in the GRASS terminal:

please try out r53791. Martin

IIUC, this is for 6.5 ?

With a fresh checkout and compile (r53809), the issue seems to be solved for 6.5. I'm still waiting for 64releasebranch to compile.

Moritz

Hi,

2012/11/14 Moritz Lennert <mlennert@club.worldonline.be>:

please try out r53791. Martin

IIUC, this is for 6.5 ?

With a fresh checkout and compile (r53809), the issue seems to be solved for
6.5. I'm still waiting for 64releasebranch to compile.

no, 6.4 [1].

Martin

[1] http://trac.osgeo.org/grass/changeset/53791

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

On 14/11/12 18:10, Martin Landa wrote:

Hi,

2012/11/14 Moritz Lennert<mlennert@club.worldonline.be>:

please try out r53791. Martin

IIUC, this is for 6.5 ?

With a fresh checkout and compile (r53809), the issue seems to be solved for
6.5. I'm still waiting for 64releasebranch to compile.

no, 6.4 [1].

Yeah, must have been asleep. It now works in all branches, thanks ! But I noticed an intriguing difference:

Debian GNU/Linux locale settings:

$ locale
LANG=fr_BE.UTF-8
LANGUAGE=
LC_CTYPE="fr_BE.UTF-8"
LC_NUMERIC="fr_BE.UTF-8"
LC_TIME="fr_BE.UTF-8"
LC_COLLATE="fr_BE.UTF-8"
LC_MONETARY="fr_BE.UTF-8"
LC_MESSAGES="fr_BE.UTF-8"
LC_PAPER="fr_BE.UTF-8"
LC_NAME="fr_BE.UTF-8"
LC_ADDRESS="fr_BE.UTF-8"
LC_TELEPHONE="fr_BE.UTF-8"
LC_MEASUREMENT="fr_BE.UTF-8"
LC_IDENTIFICATION="fr_BE.UTF-8"
LC_ALL=

GRASS6.4release locale settings:

GRASS 6.4.3svn:~ > locale
LANG=fr_BE.UTF-8
LANGUAGE=fr_BE.UTF-8
LC_CTYPE="fr_BE.UTF-8"
LC_NUMERIC="fr_BE.UTF-8"
LC_TIME="fr_BE.UTF-8"
LC_COLLATE="fr_BE.UTF-8"
LC_MONETARY="fr_BE.UTF-8"
LC_MESSAGES="fr_BE.UTF-8"
LC_PAPER="fr_BE.UTF-8"
LC_NAME="fr_BE.UTF-8"
LC_ADDRESS="fr_BE.UTF-8"
LC_TELEPHONE="fr_BE.UTF-8"
LC_MEASUREMENT="fr_BE.UTF-8"
LC_IDENTIFICATION="fr_BE.UTF-8"
LC_ALL=

GRASS65 locale settings:

GRASS 6.5.svn:~ > locale
LANG=fr_BE.UTF-8
LANGUAGE=
LC_CTYPE="fr_BE.UTF-8"
LC_NUMERIC="fr_BE.UTF-8"
LC_TIME="fr_BE.UTF-8"
LC_COLLATE="fr_BE.UTF-8"
LC_MONETARY="fr_BE.UTF-8"
LC_MESSAGES="fr_BE.UTF-8"
LC_PAPER="fr_BE.UTF-8"
LC_NAME="fr_BE.UTF-8"
LC_ADDRESS="fr_BE.UTF-8"
LC_TELEPHONE="fr_BE.UTF-8"
LC_MEASUREMENT="fr_BE.UTF-8"
LC_IDENTIFICATION="fr_BE.UTF-8"
LC_ALL=

GRASS7 locale settings:

GRASS 7.0.svn:~ > locale
LANG=fr_BE
LANGUAGE=fr_BE
LC_CTYPE=fr_BE.UTF8
LC_NUMERIC=C
LC_TIME=fr_BE.UTF8
LC_COLLATE=fr_BE.UTF8
LC_MONETARY=fr_BE.UTF8
LC_MESSAGES=fr_BE.UTF8
LC_PAPER=fr_BE.UTF8
LC_NAME=fr_BE.UTF8
LC_ADDRESS=fr_BE.UTF8
LC_TELEPHONE=fr_BE.UTF8
LC_MEASUREMENT=fr_BE.UTF8
LC_IDENTIFICATION=fr_BE.UTF8
LC_ALL=

Note the empty LANGUAGE in 6.5.

Moritz

Hi,

2012/11/14 Maris Nartiss <maris.gis@gmail.com>:

all fuss is about MY personal opinion that GRASS SHOULD NOT mess with
system provided locale and language settings UNLESS requested. I
re-run commands from previous mail with r52597 and here is result:
LANG=garbage bin.x86_64-unknown-linux-gnu/grass70
Satīra pagaidu failus...
Startē GRASS GIS...
(and GRASS starts just fine without any error messages as it is not
playing tricks with LANG at all)

you asked for language called 'garbage'
$ LANG=garbage grass70
...
Failed to set LC_ALL to garbage.UTF-8 (unsupported locale setting)

it indicates that there is no such locales on your system. So far
seems to be something what I would expect.

After changing language to de (unsupported locale on my system):
bin.x86_64-unknown-linux-gnu/grass70
Failed to set LC_ALL to de_DE.UTF-8
THIS TEXT IS IN GERMAN
Starting GRASS GIS...

(process:11622): Gdk-WARNING **: locale not supported by C library

(process:11622): Gtk-WARNING **: Locale not supported by C library.
        Using the fallback 'C' locale.

Changing language settings in wxGUI preferences to 'de'. Since I don't
have german locales on my system, it fails for wxWidgets.

Failed to set LC_ALL to de_DE.UTF-8 (unsupported locale setting)

The rest of GUI starts in german, since po files for 'de' are
available. I am not sure what you mean by mess you are referring to.
Probably you are point out that major part of GUI is localized (comes
from GRASS po files) and minor part (wxWidgets) is kept in system
locales. We have three options:

1. keep current behaviour
2. if setting LC_ALL fails then go back to system settings (don't use
GRASS po files).
3. fix settings wxWidgets locales even if locales are not available.

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa