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.
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.
Regards, Michael