Opened 10 years ago

Closed 8 years ago

#2360 closed defect (wontfix)

grass startup script and wx preference file: language setting in wx does not contain country specific language code

Reported by: mlennert Owned by: grass-dev@…
Priority: minor Milestone: 7.0.5
Component: Startup Version: svn-trunk
Keywords: locale Cc:
CPU: Unspecified Platform: Unspecified

Description

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.

Change History (4)

comment:1 by marisn, 10 years ago

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.

comment:2 by martinl, 8 years ago

Milestone: 7.0.07.0.5

comment:3 by martinl, 8 years ago

Still the issue?

in reply to:  3 comment:4 by mlennert, 8 years ago

Resolution: wontfix
Status: newclosed

Replying to martinl:

Still the issue?

The issue hasn't changed, and probably neither has the difficulty of solving it. I don't know if the warning could be improved, but I lack inspiration.

I don't know either if it is worth creating a fr_BE translation...

I guess this is just a small issue in the general difficulty of locale handling and the error message gives the necessary info, so closing this as wontfix.

Note: See TracTickets for help on using tickets.