[GRASS-dev] [GRASS GIS] #2360: grass startup script and wx preference file: language setting in wx does not contain country specific language code

#2360: grass startup script and wx preference file: language setting in wx does
not contain country specific language code
-------------------------+--------------------------------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: minor | Milestone: 7.0.0
Component: Startup | Version: svn-trunk
Keywords: locale | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
When I launch grass7 (fresh from trunk), I get the following message at
startup:

{{{
WARNING: A language override has been requested. Trying to switch GRASS
into 'fr'...
Failed to enforce user specified language 'fr' with error: 'unsupported
locale setting'
A LANGUAGE environmental variable has been set.
Part of messages will be displayed in the requested language.
}}}

Tracing back what happens I see that when the user sets a language
preference in the wx gui, this preference is stored in the .grass7/wx file
as the two-letter language code ('fr' for French in this case). The locale
checking and setting magic in set_language() in the grass7 startup script
uses (among others):

{{{
encoding = 'UTF-8'
normalized = locale.normalize('%s.%s' % (language, encoding))
locale.setlocale(locale.LC_ALL, normalized)
}}}

However, locale.normalize in this case transforms fr into fr_FR, whereas
on my machine the only installed locale is fr_BE. Now I can just install
fr_FR and the message goes away, and even with the message, GRASS seems to
work ok, so this is not a major issue. However, it might throw off some
users to see this message every time they start GRASS.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2360&gt;
GRASS GIS <http://grass.osgeo.org>

#2360: grass startup script and wx preference file: language setting in wx does
not contain country specific language code
-------------------------+--------------------------------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: minor | Milestone: 7.0.0
Component: Startup | Version: svn-trunk
Keywords: locale | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by marisn):

I'm not certain that this is solvable at all. The set_language "magic" is
trying to get most out of language override and gives a warning when it
doesn't work. Seems that Python simply prefers "fr_FR" over installed
locales. When writing the "magic", I was testing various ways how it could
work, but, unfortunately, each of them was failing in some other way.

The only solution for fr_BE problem would be to translate GRASS to fr_BE,
as it has been done for pt_BR. Or come up with a cool Python hack to
replace locale.normalize with an in-home version that prefers installed
locales.

As the warning affects only those users requesting language override (this
is not a "normal" use case), I would say the warning is not a problem.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2360#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>