Am Mittwoch, 12. Oktober 2005 22:08 schrieb Michael Gerz: > Martin Vermeer wrote: > > >Neither am I... but I did it anyway, just to get the stuff working. But > >your idea is better. > > > >All you have to do, at start-up, is > > > >1) Check that a locale is defined, and if not, define en_US; > >2) remove any encoding suffixes like fi_FI.utf-8 --> fi_FI. > > > >Doing it in one place at start-up (and only using, say, LC_ALL or LANG, > >and making the others conform) would allow a lot of special code to be > >taken out. In theory.
The problem is that this would also change the encoding for child processes if we sue setenv(), such as viewers and editors for graphics. So this is actually not so good. We could however strip the suffix and cache the value internally, but this is IMHO not for 1.4.0. > >I wonder if this is 1.4 stuff. Perhaps not. So I say, do the minimal > >patch based on Michael's idea. > > > > > > I had a very short look at the code this evening. AFAICS we need all the > stuff because we want to control the translation based on the language > of the current document. In other words, you can have a Finnish UI with > German layout styles (labels). The code in messages.C seems to do the > right thing. > > Nevertheless, my patch changes it in two ways: > > - It checks a couple of environment variables to determine lang_. This > is needed for MinGW on the Windows platform. > > - It moves a couple of checks out of the getter method and into the > constructor. This is more efficient but not necessary in principle. > > But, of course, it would be nice if someone with more gettext experience > could have a look at the code as well. I am wondering whether we need to work around a broken setlocale() on windows. Isn't it possible to fix it? Georg